Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Is it the Stencil buffer?

Sign in to follow this  


I'm still having the a problem with my mesh rendering.

To try to figure it out I posted a thread on both Game Dev and Indie Gamer.

One response I received from the Indie Gamer post indicated that my problem was because I was not setting my stencil buffer when I switched my render target. So in order to fix the problem I created a global surface called g_pStencilSurface. I then did called the following line to retrieve my stencil from the device:

g_pDevice->GetDepthStencilSurface( &g_pStencilSurface );

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

g_pDevice->SetRenderTarget( g_pBackSurface, g_pStencilSurface );

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 will continue to investigate.
Sign in to follow this  


Recommended Comments

There are no comments to display.

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
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!