Jump to content
  • Advertisement
Sign in to follow this  
browny

Resizing a DX window

This topic is 4101 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Share this post


Link to post
Share on other sites
Advertisement
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
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
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
@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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!