Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAmr0

Posted 06 July 2013 - 04:45 AM

Check this out: Efficient Multiple Windows in Direct3D

Though it's not SlimDX and talks about multiple windows, the same idea can be used with a single resizable window.

Quoting the main idea for those who don't like jumping through links:

 

 

 

This other approach which is demonstrated in the sample below is rather simple but does the job quite nicely. Here is how it goes. When it's time to render:
pD3DDevice->SetViewport( x=0, y=0, width and height = window's client rectangle );
pD3DDevice->BeginScene();
RenderWindowContents( hWnd );
pD3DDevice->EndScene();
pD3DDevice->Present( destRect = window's clientRect, NULL, hWnd, NULL );
ValidateRect( hWnd, NULL ); // No need for additional win32 painting.

This approach allows the user to freely resize a window without having to reinitialize a swap chain. It uses the observation that a window can not be larger than the desktop, so we render its contents to a rectangle as large as the window's client area in the left top corner of the back buffer, then present that rectangle into the window. This effectively copies the contents of that area into the window, and then the next window can overwrite the back buffer since its contents are no longer needed, regardless of where the windows are.

#3Amr0

Posted 06 July 2013 - 04:40 AM

Check this out: Efficient Multiple Windows in Direct3D

Though it talks about multiple windows, the same idea can be used with a single resizable window.

Quoting the main idea for those who don't like jumping through links:

 

 

 

This other approach which is demonstrated in the sample below is rather simple but does the job quite nicely. Here is how it goes. When it's time to render:
pD3DDevice->SetViewport( x=0, y=0, width and height = window's client rectangle );
pD3DDevice->BeginScene();
RenderWindowContents( hWnd );
pD3DDevice->EndScene();
pD3DDevice->Present( destRect = window's clientRect, NULL, hWnd, NULL );
ValidateRect( hWnd, NULL ); // No need for additional win32 painting.

This approach allows the user to freely resize a window without having to reinitialize a swap chain. It uses the observation that a window can not be larger than the desktop, so we render its contents to a rectangle as large as the window's client area in the left top corner of the back buffer, then present that rectangle into the window. This effectively copies the contents of that area into the window, and then the next window can overwrite the back buffer since its contents are no longer needed, regardless of where the windows are.

#2Amr0

Posted 06 July 2013 - 04:39 AM

Check this out: Efficient Multiple Windows in Direct3D

Though it talks about multiple windows, the same idea can be used with a single resizable window.

Quoting the main idea for those who don't like jumping through links:

 

<p>This other approach which is demonstrated in the sample below is rather simple but does the job quite nicely. Here is how it goes. When it's time to render:</p>
<ol class="rounded-list">
<li><a>pD3DDevice-&gt;SetViewport( x=0, y=0, width and height = window's client rectangle );</a></li>
<li><a>pD3DDevice-&gt;BeginScene();</a></li>
<li><a>RenderWindowContents( hWnd );</a></li>
<li><a>pD3DDevice-&gt;EndScene();</a></li>
<li><a>pD3DDevice-&gt;Present( destRect = window's clientRect, NULL, hWnd, NULL );</a></li>
<li><a>ValidateRect( hWnd, NULL ); // No need for additional win32 painting.</a></li>
</ol>
<p>This approach allows the user to freely resize a window without having to reinitialize a swap chain. It uses the observation that a window can not be larger than the desktop, so we render its contents to a rectangle as large as the window's client area in the left top corner of the back buffer, then present that rectangle into the window. This effectively copies the contents of that area into the window, and then the next window can overwrite the back buffer since its contents are no longer needed, regardless of where the windows are.</p>


#1Amr0

Posted 06 July 2013 - 04:30 AM

Check this out: Efficient Multiple Windows in Direct3D

Though it talks about multiple windows, the same idea can be used with a single resizable window.


PARTNERS