resize help

anybody know how to resize a direct3d window and allow the window contents to resize dynamically while draging the resize

Thanks in advance,

Devin


Answer this question

resize help

  • vailyve

    This is standard behaviour; you get the same in native DirectX as well as MDX...

    The lines and such in the window get stretched with the window as if distorting to fit the new picture box size.

    The internal Direct3D representation hasn't changed size, only the "view" on that representation has. Thus it stretches the Direct3D representation to the size of the "view". Which almost always results in a blurring of the image.

    Is there a way to keep the distortion from occuring with this method   ie: replace the rendertarget or something

    Reset the device. I think this was suggested earlier, but the basic idea is that you have to re-create the swapchain to match the new size of the "view" on the Direct3D representation.

    Unfortunately, I'm not an MDX programmer so I can't offer you any code to sort this out. I would recommend digging into the framework code - presuming it's the functionally equivalent to the C++ version it should handle this case correctly (a quick test - if the SDK samples respond correctly then it does!) and you can extract the relevant code.

    hth
    Jack


  • davidbellot

    As long as you recreate the device and rerender the window inside the resize event it should work fine. The only reason that the samples don't do this is becuase the rendering is done in the OnIdle event which isn't firing during the resize.



  • techie_ns

    I'm still having trouble, I noticed that if I cancel the resizing event via

    void device_DeviceResizing(object sender, System.ComponentModel.CancelEventArgs e)

    {

    e.Cancel = true;
    }

    then I can drag the window and it works super but with one problem.  The lines and such in the window get stretched with the window as if distorting to fit the new picture box size.  Is there a way to keep the distortion from occuring with this method   ie: replace the rendertarget or something


  • Finch82

  • mPaskov

    What if I simply reset the device, evict resources and then recreate resources.  Would this work instead or is that the same thing
  • resize help