This topic is now archived and is closed to further replies.


Direct 3D + Multiple Windows

Recommended Posts

blahpers    122
Okay. This project uses multiple windows, each of which can have graphics. I''m using Direct3D, which I''ve gotten pretty good at--at least in single-window environments. Anyone know any good material regarding using Direct3D with multiple windows (not multiple monitors)? Or, if anyone''s had decent experience writing multi-window Direct3D code, got any advice? /* blahpers */ --- blahpers

Share this post

Link to post
Share on other sites
Do a CreateAdditionalSwapChain for each extra window (or possibly just each different sized window)

Don''t use auto depth stencil on the extra swap chains as there is no way to query the depth surface.

Create a z buffer for each swap chain.

Render as though rendering to a texture (Query the swap chain for it''s back buffer, and use the Z you created above)

Present the swap chain to draw to an extra window.

One of the arguments to present (both in the device and each swap chain) is an hwnd. Each swap chain has an hwnd associated with it, just like your device does, and you can pass NULL as the hwnd to present. You can also pass an hwnd for another window. This is why I said at the top that the extra swap chains could just be for different sized windows, as you could render, swap, render, swap to another hwnd, render more, swap to yet another hwnd, etc.

Destroy and recreate your swap chains on Reset like any other DX resource.

Share this post

Link to post
Share on other sites