Jump to content
  • Advertisement
Sign in to follow this  
Nanook

OpenGL How should I resize a directx 11 window?

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

With OpenGL I just resize the window with MoveWindow, change the viewport with glViewport and update the aspect ratio of my camera's frustrum.

With DX11 it seems to be some more stuff that needs to be done..

When I setup my context I set the resolution for the depth stencil, swap chain and viewport.. I know I can resize the swap chain and set a new viewport, but do I need to create a new depth stencil or can I resize it aswell?

When I try to resize the swap chain I get the error below.. does it mean every buffer I've loaded to the GPU? vertex/index buffers, texture buffers, shaders, etc ? So if I've deleted it from normal memory I would need to load every thing up from files again?

DXGI Error: Swapchain cannot be resized unless all outstanding buffer references have been released.

Share this post


Link to post
Share on other sites
Advertisement
No. It means you have a reference to the swap chain, or one of its buffers, still alive. Make sure you release it.

Share this post


Link to post
Share on other sites
After you create a swap chain, you call IDXGISwapChain::GetBuffer to get an ID3D11Texture2D interface for the back buffer. Then you typically create a render target view for the back buffer. When you want to resize the swap chain, you need to call Release on both the ID3D11Texture2D as well as the ID3D11RenderTargetView for the back buffer. Then you can call ResizeBuffers on the swap chain.

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!