• Advertisement
Sign in to follow this  

DirectX11 Help with Multiple Render Targets

This topic is 2419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have had no luck all day trying to get multiple render targets to work. I have used them before in DirectX9 so the concept is not new, just the syntax. I keep getting an access violation error when calling OMSetRenderTargets. I would be very grateful if someone could point out the flaw in my logic. Here is the basic break down of what I'm doing,

ID3D11RenderTargetView* pRenderTargetView[2];

// Create the render target view with the back buffer pointer.
hr = pDevice->CreateRenderTargetView( pBackBuffer, NULL, &pRenderTargetView[0] );

hr = pDevice->CreateRenderTargetView( pRTargetTexture, &renderTargetViewDesc, &pRenderTargetView[1] );

==========

pDeviceContext->OMSetRenderTargets( 2, pRenderTargetView, NULL );

pDeviceContext->ClearRenderTargetView( pRenderTargetView[0], clearColor );
pDeviceContext->ClearRenderTargetView( pRenderTargetView[1], clearColor );

// Draw Geometry

pSwapChain->Present(1, 0);

Share this post


Link to post
Share on other sites
Advertisement

After calling [font="Lucida Console"]CreateRenderTargetView[/font], are you validating the return value and checking that your array of pointers has actually been filled in?


Yeah, the HRESULT returns OK

Share this post


Link to post
Share on other sites
my guessing is that you forget to get actual backbuffer address.
in initialize phaze like this
pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ),(LPVOID*)&pBackBuffer);

Share this post


Link to post
Share on other sites

my guessing is that you forget to get actual backbuffer address.
in initialize phaze like this
pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ),(LPVOID*)&pBackBuffer);


I do that for the back buffer, is there something similar I need to do for the render target?

I'm no longer getting the error message, and the back buffer is drawing fine. However, when I go to draw a small 2D quad of the render target's texture on the screen it is black. I'm even setting the clear color to red, but it still shows as a black quad. I've tested the textured quad drawing on a texture read from a file, so I know that is working correctly.

Share this post


Link to post
Share on other sites

I do that for the back buffer, is there something similar I need to do for the render target?

cant sure without actual code.

assuming the texture is fine, and still screen is black,then possible reasons are ....

1.polygon culling mode. set D3D10_RASTERIZER_DESC::CullMode to CULL_NONE.

2.the quad has no UV. or you dont pass the texture to the shader.(i mean you dont map the texture on the quad)

3.RenderTaget is not work. one or the other. or both. does clear color work on the normal rendertarget(i mean backbuffer one).

Share this post


Link to post
Share on other sites

[quote name='myers80' timestamp='1307678277' post='4821585']
I do that for the back buffer, is there something similar I need to do for the render target?

cant sure without actual code.

assuming the texture is fine, and still screen is black,then possible reasons are ....

1.polygon culling mode. set D3D10_RASTERIZER_DESC::CullMode to CULL_NONE.

2.the quad has no UV. or you dont pass the texture to the shader.(i mean you dont map the texture on the quad)

3.RenderTaget is not work. one or the other. or both. does clear color work on the normal rendertarget(i mean backbuffer one).
[/quote]

Got it! I wasn't releasing the render target from the geometry pass before drawing it on the quad. Thank you for your help though, you got me thinking :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement