Sign in to follow this  

Stencil buffer

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

a Stencil buffer is a per pixel buffer that allows the user to stencil out parts that the user don't want to render. Stencilling as it's called is like masking out parts of the scene that you don't want rendered. The most typical usage of the stencil buffers are usually mirrors and shadows. You can look at these tutorials on using the stencil buffer.
Stencil Buffer Tutorial from NVidia
Stencil Buffer Tutorial from Me

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
These are some typical present params that I use:

[source lang=c#]
this.presentParams.Windowed = true;//I'm using windowed mode
this.presentParams.SwapEffect = SwapEffect.Discard;
this.presentParams.AutoDepthStencilFormat = DepthFormat.D16;
this.presentParams.EnableAutoDepthStencil = true;



but you have to remember to clear the depth buffer at the beginning of the scene:

[source lang=c#]
this.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Black, 1.0f, 0);
this.device.BeginScene();
//...Your draw code goes here
this.device.EndScene();



Share this post


Link to post
Share on other sites

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