Jump to content
  • Advertisement
Sign in to follow this  
schupf

D3D9: Resize in Windowed Application

This topic is 2609 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

Hello,

I have a D3D9 windowed application. When I create the device I do not specify any dimensions for the backbuffer. For example:

mPresentParams.BackBufferWidth = 0;
mPresentParams.BackBufferHeight = 0;

Now I wonder if I have to do anything when I resize the window? Do I have to reset() the device if the window is resized?

Share this post


Link to post
Share on other sites
Advertisement
Creating your device that way means that it will create a back buffer with the same size as your window's client area. If the window changes size, you don't *have* to change your backbuffer size but if you don't, what you're rendering will appear either squashed or stretched. So if you don't want that to happen, you should reset the device so that the backbuffer continues to match the window size.

Share this post


Link to post
Share on other sites
Hm ok. So after the window has been resized I just reset() the device with a new PresentParameters struct were BackBufferWidth and BackBufferHeight is again 0?

Share this post


Link to post
Share on other sites

Hm ok. So after the window has been resized I just reset() the device with a new PresentParameters struct were BackBufferWidth and BackBufferHeight is again 0?


Yes. Just don't forget that you cannot simply reuse the PresentParams structure you used to create the device, because it autimatically overwrites your 0 dimensions with the actual size. You have to set them back to zero.
Also, "just reset()" of course have to mean to do all what a device reset requires (freeing non-managed resources etc.).

Share this post


Link to post
Share on other sites
Thanks for the hint with the resetting of width/height! I definitely would have missed that:)

Share this post


Link to post
Share on other sites
Just don't make the same mistake I did and use D3DPOOL_DEFAULT for everything ;D Otherwise you'll have to release and recreate everything created using DEFAULT when you call device reset. USE MANAGED! tongue.gif
The only thing I have to do is call my font's OnResetDevice before and OnLostDevice after resetting the device.

Good luck, Mal ^_^

Share this post


Link to post
Share on other sites
The only thing I have to do is call my font's OnResetDevice before and OnLostDevice after resetting the device.


And Effect's and Sprite's ;)

Share this post


Link to post
Share on other sites

[quote name='malborojones' timestamp='1306688931' post='4817163']The only thing I have to do is call my font's OnResetDevice before and OnLostDevice after resetting the device.


And Effect's and Sprite's ;)
[/quote]

If you're using them x) Sprite's are okay I think as long as you use the managed pool for their textures. I don't have to reload any of the sprites when calling Reset ^_^

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!