If i have created a separate swap chain for a child window that i want to render to, how would i get its position in the RenderTargetIndex so I can use SetRenderTarget?
Jump to content
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Posted 26 February 2013 - 06:25 AM
That's not what the index is for. When drawing, the triangles are drawn to the currently bound render target(s). Usually you only have a single render-target bound at a time, to index 0, however by using different indices, you can bind more than one render target simultaneously. This allows your pixel shader to output multiple colour values -- the triangle is drawn to the same position to every bound render-target, but different colour values are written. This is known as MRT (multiple render targets) and is usually how deferred rendering is implemented.
You use the Present function to make swap-chains appear on the screen, or GetBackBuffer to retrieve a swap-chain object's internal render-target that will be presented.
Posted 26 February 2013 - 06:46 AM
Ok...I tried to mod this example: http://www.mvps.org/directx/articles/rendering_to_multiple_windows.htm
to work with DirectX9 but it appears there are certain things done here that i cant do. I tried switching to getting the back buffer of my swapchain and using ColorFill on it but more often than not i get the same scene as what is being rendered to the main window and then the program totally freezes. Any one got any ideas? So far there seems to be almost nil on the web about drawing to child windows without interfering with the main window...
Edited by Naruto-kun, 26 February 2013 - 08:21 AM.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.