Recommended Posts

I have an application where the window might be resized. Btw, i am quite new in DirectX, so i am just wondering how do i handle this.. I think i need to reset/resize the backbuffer as well.. otherwise the image looks blurry when the window is stretched. Is there a way to resize the backbuffer without re-creating the device and etc... ?

0

Share this post

Link to post

Share on other sites

Yes you will need to resize the back buffer and you will have to reset the lost device. Check out this link on how to reset lost devices. You will also have to be careful to release and re-create all resources created with D3DPOOL_DEFAULT.

0

Share this post

Link to post

Share on other sites

One trick is create the backbuffer as something trivial, ie: 1x1. Use CreateAdditionalSwapChain/CreateDepthStencilSurface to make your real backbuffer and depth buffer. Use the present in the swapchain rather than in the device. On resize, kill the swapchain and recreate it. You won't have to worry about recreating all your POOL_DEFAULT objects. It's very fast.

Keep in mind you'll still want to handle a full device reset for when the device gets lost, or switching between fullscreen/windowed mode, etc, you just won't use that method for handling a window resize.

0

Share this post

Link to post

Share on other sites

Original post by NamethatnobodyelsetookOne trick is create the backbuffer as something trivial, ie: 1x1. Use CreateAdditionalSwapChain/CreateDepthStencilSurface to make your real backbuffer and depth buffer. Use the present in the swapchain rather than in the device. On resize, kill the swapchain and recreate it. You won't have to worry about recreating all your POOL_DEFAULT objects. It's very fast.

Keep in mind you'll still want to handle a full device reset for when the device gets lost, or switching between fullscreen/windowed mode, etc, you just won't use that method for handling a window resize.

Ooh, that's nifty [smile]

I'm going to jot that down somewhere...

0

Share this post

Link to post

Share on other sites

Original post by NamethatnobodyelsetookOne trick is create the backbuffer as something trivial, ie: 1x1. Use CreateAdditionalSwapChain/CreateDepthStencilSurface to make your real backbuffer and depth buffer. Use the present in the swapchain rather than in the device. On resize, kill the swapchain and recreate it. You won't have to worry about recreating all your POOL_DEFAULT objects. It's very fast.

Keep in mind you'll still want to handle a full device reset for when the device gets lost, or switching between fullscreen/windowed mode, etc, you just won't use that method for handling a window resize.