Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualbackstep

Posted 24 September 2013 - 03:30 PM

You can use the client rectangle you're already fetching in your ResizeSwapChain function, rather than passing it in from the WM_SIZE params.  I think GetClientRect will be more reliable.  i.e. change the function to:









void D3D11::ResizeSwapChain() //removed passed by value arguments
{
    if (swapChain)
    {
        RECT rc;
        GetClientRect(hwnd, &rc);
        UINT width = rc.right;
        UINT height = rc.bottom;

Edit: nevermind, I'm wrong!  I just checked it with my own DX11 resize and passing 0, 0 for width and height to ResizeBuffers is working fine.  It detects the correct client size on window size changes.

 

If I had to guess I'd say maybe take a look at your projection matrix?  If you're changing the window client size it's possible you're changing the aspect ratio of the client area and will need to re-create your projection matrix.

 

Oh one last thing, it's possible your viewport resize is lagging way behind your actual client size when you use the WM_SIZE params for it.  So try the code I posted above, it may keep your viewport size in-sync with your backbuffer size.  


#5backstep

Posted 24 September 2013 - 03:26 PM

You can use the client rectangle you're already fetching in your ResizeSwapChain function, rather than passing it in from the WM_SIZE params.  I think GetClientRect will be more reliable.  i.e. change the function to:







void D3D11::ResizeSwapChain() //removed passed by value arguments
{
    if (swapChain)
    {
        RECT rc;
        GetClientRect(hwnd, &rc);
        UINT width = rc.right;
        UINT height = rc.bottom;

Edit: nevermind, I'm wrong!  I just checked it with my own DX11 resize and passing 0, 0 for width and height to ResizeBuffers is working fine.  It detects the correct client size on window size changes.

 

If I had to guess I'd say maybe take a look at your projection matrix?  If you're changing the window client size it's possible you're changing the aspect ratio of the client area and will need to re-create your projection matrix.


#4backstep

Posted 24 September 2013 - 03:00 PM

You can use the client rectangle you're already fetching in your ResizeSwapChain function, rather than passing it in from the WM_SIZE params.  I think GetClientRect will be more reliable.  i.e. change the function to:





void D3D11::ResizeSwapChain() //removed passed by value arguments
{
    if (swapChain)
    {
        RECT rc;
        GetClientRect(hwnd, &rc);
        UINT width = rc.right;
        UINT height = rc.bottom;
 
        //rest of the function is the same...except you need to change the ResizeBuffers call to

        swapChain->ResizeBuffers(1, width, height, DXGI_FORMAT_R8G8B8A8_UNORM, 0);

Edit: Noticed your ResizeBuffers API call was missing width/height parameters, which I think means the previous values are used (i.e. no actual buffer resize occurs).


#3backstep

Posted 24 September 2013 - 02:59 PM

You can use the client rectangle you're already fetching in your ResizeSwapChain function, rather than passing it in from the WM_SIZE params.  I think GetClientRect will be more reliable.  i.e. change the function to:



void D3D11::ResizeSwapChain() //removed passed by value arguments
{
        if (swapChain)
        {RECT rc;
        GetClientRect(hwnd, &rc);
        UINT width = rc.right;
        UINT height = rc.bottom;
 
        //rest of the function is the same...except you need to change the ResizeBuffers call to

        swapChain->ResizeBuffers(1, width, height, DXGI_FORMAT_R8G8B8A8_UNORM, 0);

Edit: Noticed your ResizeBuffers API call was missing width/height parameters, which I think means the previous values are used (i.e. no actual buffer resize occurs).


#2backstep

Posted 24 September 2013 - 02:57 PM

You can use the client rectangle you're already fetching in your ResizeSwapChain function, rather than passing it in from the WM_SIZE params.  I think GetClientRect will be more reliable.  i.e. change the function to:

void D3D11::ResizeSwapChain() //removed passed by value arguments
{
        if (swapChain)
        {RECT rc;
        GetClientRect(hwnd, &rc);
        UINT width = rc.right;
        UINT height = rc.bottom;
 
        //rest of the function is the same...except you need to change the ResizeBuffers call to

        swapChain->ResizeBuffers(1, width, height, DXGI_FORMAT_R8G8B8A8_UNORM, 0);

#1backstep

Posted 24 September 2013 - 02:54 PM

You can use the client rectangle you're already fetching in your ResizeSwapChain function, rather than passing it in from the WM_SIZE params.  I think GetClientRect will be more reliable.  i.e. change the function to:

 

 

void D3D11::ResizeSwapChain() //removed passed by value arguments
{
        if (swapChain)
        {RECT rc;
        GetClientRect(hwnd, &rc);
        UINT width = rc.right;
        UINT height = rc.bottom;
 
        //rest of the function is the same...

PARTNERS