Re: Doom 3 engine release and game code
had to do some guess work with your codepiece as the qglStencilOpSeparate seems to be an ATI extention i tried with standard two sided stencil but it needs some work.
- Code:
if (external)
{
glDepthFunc (GL_LEQUAL);
glEnable (GL_STENCIL_TEST_TWO_SIDE_EXT);
// view outside the shadow volume
qglActiveStencilFaceEXT(GL_BACK);
qglStencilOp(GL_KEEP, tr.stencilIncr, tr.stencilIncr);
qglStencilFunc(GL_ALWAYS, 0, ~0);
// does the same as the GL_TwoSidedStencil functions part when checking for cull face.
GL_Cull( CT_BACK_SIDED );
qglActiveStencilFaceEXT(GL_FRONT);
qglStencilOp(GL_KEEP, tr.stencilDecr, tr.stencilDecr);
qglStencilFunc(GL_ALWAYS, 0, ~0);
// does the same as the GL_TwoSidedStencil functions part when checking for cull face.
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters (tri, numIndexes);
glDisable (GL_STENCIL_TEST_TWO_SIDE_EXT);
}
else
{
glDepthFunc (GL_GEQUAL);
glEnable (GL_STENCIL_TEST_TWO_SIDE_EXT);
// view inside the shadow volume
qglActiveStencilFaceEXT(GL_BACK);
qglStencilOp(GL_KEEP, tr.stencilDecr, tr.stencilDecr);
qglStencilFunc(GL_ALWAYS, 0, ~0);
// does the same as the GL_TwoSidedStencil functions part when checking for cull face.
GL_Cull( CT_FRONT_SIDED );
qglActiveStencilFaceEXT(GL_FRONT);
qglStencilOp(GL_KEEP, tr.stencilIncr, tr.stencilIncr);
qglStencilFunc(GL_ALWAYS, 0, ~0);
// does the same as the GL_TwoSidedStencil functions part when checking for cull face.
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters (tri, numIndexes);
glDisable (GL_STENCIL_TEST_TWO_SIDE_EXT);
}
its CT_TWO_SIDED when comming in here so face culling is off untill it hits this function.
