Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How should I resize a directx 11 window?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Nanook   Members   -  Reputation: 505

Like
1Likes
Like

Posted 18 April 2012 - 06:47 PM

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.

Sponsor:

#2 Washu   Senior Moderators   -  Reputation: 5368

Like
1Likes
Like

Posted 18 April 2012 - 07:05 PM

No. It means you have a reference to the swap chain, or one of its buffers, still alive. Make sure you release it.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
ScapeCode - Blog | SlimDX


#3 MJP   Moderators   -  Reputation: 11609

Like
2Likes
Like

Posted 18 April 2012 - 08:24 PM

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.

#4 Nanook   Members   -  Reputation: 505

Like
0Likes
Like

Posted 19 April 2012 - 03:56 PM

Cool that worked.. thanks

#5 Martins Mozeiko   Crossbones+   -  Reputation: 1422

Like
1Likes
Like

Posted 19 April 2012 - 06:06 PM

Btw, here it is written in DXGI Programming Guide: http://msdn.microsoft.com/en-us/library/windows/desktop/bb205075.aspx#Handling_Window_Resizing




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS