Sign in to follow this  
browny

Resizing a DX window

Recommended Posts

browny    139
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... ?

Share this post


Link to post
Share on other sites
_neutrin0_    241
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.

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.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by Namethatnobodyelsetook
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.
Ooh, that's nifty [smile]

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

Share this post


Link to post
Share on other sites
_neutrin0_    241
Quote:
Original post by Namethatnobodyelsetook
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.


Wow... cool indeed.

Share this post


Link to post
Share on other sites
browny    139
@Namethatnobodyelsetook .. hmm.. sounds like a great idea.. will implement that soon. Thanks guys, GD.net rocks :)

Share this post


Link to post
Share on other sites
Riekistyx    100
NO! lol

Devices ARE NOT lost in window'd mode else you got a funky computer.

lost and reset crap is only needed on testcorpativelevel

this is triggered from alt tab only in fullscreen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this