Jump to content
  • Advertisement
Sign in to follow this  
TheSLASH

Aspect Ratio

This topic is 4590 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 problem when I try to resize the window, the aspect ratio of the drawn content i wrong, it is streched. I do use a sprite (LPD3DXSPRITE) for the content, and some text (LPD3DXFONT), all in the window get's wrong aspect ratio. Here is the resize fuction: void ResizeScene(int width, int height) { D3DXMATRIXA16 matProjection; D3DXMatrixPerspectiveFovLH( &matProjection, 45.0f, (float)width/(float)height, 0.1f, 100.0f ); gpDevice->SetTransform( D3DTS_PROJECTION, &matProjection ); } I have used it from both WM_SIZE and WM_SIZING without positive result, nothing happends... The setup is DirectX 9.0c, and SDK from summer 2003.

Share this post


Link to post
Share on other sites
Advertisement
Do you actually reset the device, updating the D3DPRESENT_PARAMETERS with the new window dimensions? Not doing this will generally result in a stretched out display, which you described.

In general, what you want to do:

- Detect a resize
- Release all of your default pool objects, call OnDeviceLoss() on D3DX interfaces
- Update presentation parameters
- IDirect3DDevice9::Reset()
- Recreate all of your default pool object, call OnDeviceReset() on D3DX interfaces.

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!