Sign in to follow this  
Naruto-kun

IDirect3DDevice9::SetRenderTarget

Recommended Posts

Naruto-kun    442

Hi guys

 

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?

 

Thanks

JB

Share this post


Link to post
Share on other sites
Hodgman    51328

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.

Share this post


Link to post
Share on other sites
Naruto-kun    442

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this