StencilTestState

Nov 28, 2010 at 9:07 AM

Hi. I'm having some trouble finding a way to set a StencilTestState for ShaderElement. Is there a way or should I just create a derived class from ShaderElement and override some methods?

Coordinator
Nov 28, 2010 at 11:01 AM
Edited Nov 28, 2010 at 11:03 AM

Ah. Yeah, you won't be able to with the standard class. Internally the *Element classes set the stencil renderstate to a fixed default because it can use stencil testing to clip child elements.

Open up Element.cs line 327, and change the following:

state.RenderState.CurrentStencilState = stencilState;

to:

if (clipTestActive)
{
    state.RenderState.CurrentStencilState = stencilState;
}