Jump to content
  • Advertisement
Sign in to follow this  
rockskull

Maintain aspect ratio of 3D scene in Windowed Application?

This topic is 5148 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 a 3D scene panel in a window (DX9+Win32, no MFC), whenever the size of the window (and the panel) is changed, the 3D scene is distorted accordingly. How do I maintain the scale ratio of the objects in the scene while the window can still be resized?

Share this post


Link to post
Share on other sites
Advertisement
When you change the size of the window that the direct 3d device is hooked up to (or one of the surfaces in the swap chain, etc.) direct 3d has to stretch the image on the old back buffer size to be displayed in the new window size. It is recommended that you change the size of the back buffer to match the new window size through a call to Reset.

Magius

Share this post


Link to post
Share on other sites
You could also intercept the WM_GETMINMAXINFO message sent to the window, and make sure that when for instance the width increases, the height increases accordingly (maintaining the aspect ratio).

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!