Sign in to follow this  

Problem setting render target... Help Please

This topic is 4593 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

When I switch render targets, my models no longer seem to have their faces rendered properly. Faces that should be obscured by faces in front of them are being rendered. I'm not sure what I should do to prevent this from happening. This is what I'm currently doing whenever I switch to render my glow surface.
	g_pDevice->SetRenderTarget( g_pGlowSurface, NULL ); 
	g_pDevice->SetRenderState(D3DRS_ZENABLE,TRUE);


Then I switch it back to the back surface basically using the same code.
	g_pDevice->SetRenderTarget( g_pBackSurface, NULL ); 
	g_pDevice->SetRenderState(D3DRS_ZENABLE,TRUE);


I didn't initially call the SetRenderState function to set ZENABLE back to true, but I added it thinking that was perhaps the problem. It didn't seem to have any effect. Here's a screen shot: Epoch Star - Space RPG Game Anyone have any ideas? Thanks

Share this post


Link to post
Share on other sites
A thread on a different forum has lead me to believe the problem is in my Stencil buffer.

I created a global surface variable to hold the stencil buffer, and called the following line after retrieving the back buffer during my initialization:

g_pDevice->GetDepthStencilSurface( &g_pStencilSurface );



Then whenever I set my render target to my back buffer I use the following lines:

g_pDevice->SetRenderTarget( g_pBackSurface, g_pStencilSurface );
g_pDevice->SetRenderState(D3DRS_ZENABLE,TRUE);



And when I set my render target to my glow surface I use this:

g_pDevice->SetRenderTarget( g_pGlowSurface, NULL );
g_pDevice->SetRenderState(D3DRS_ZENABLE,FALSE);



However, this seems to create an entirely different problem with the stencil buffer as you can see in the follwoing screenshot:

Epoch Star - Sci-Fi Space Adventure


In my presentation parameters during the initialization of my code I call:

g_SavedPresParams.EnableAutoDepthStencil = true;
g_SavedPresParams.AutoDepthStencilFormat = D3DFMT_D16;



I'm not sure if setting my presentation parameters to use an auto depth stencil would be the issue.

Anyone have any ideas?

Share this post


Link to post
Share on other sites

This topic is 4593 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.

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