EXT_stencil_two_side on ATI

Hi there

Just tried my engine on an ATI card (Radeon 4xxx), and it seems not to support EXT_stencil_two_side.

Can anyone tell me, if there is some other extension on ATI, that provides the same functionality?

The driver supports OpenGL 3.3 (though i’m using a 2.1 context atm), and i was under the impression that stencil_two_side should have been made core at some point, so i am a bit surprised that the EXT-extension is not supported.


I think it became part of core OpenGL in version 2.0, but in a different form; with the extension it is:


        glStencilOp(GL_KEEP,            // stencil test fail
                    GL_KEEP,            // depth test fail
                    GL_DECR_WRAP_EXT);  // depth test pass
        glStencilFunc(GL_ALWAYS, 0, ~0);

but in the core 2.0+:

        glStencilOpSeparate(GL_BACK, GL_KEEP,            // stencil test fail
                    GL_KEEP,            // depth test fail
                    GL_DECR_WRAP_EXT);  // depth test pass
        glStencilMaskSeparate(GL_BACK, ~0);
        glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, ~0);

In http://www.opengl.org/registry/api/gl.spec it mentions a ARB_stencil_two_side extension, but I don’t think this extension ever got added to the registry as a proper extension.

Actually it’s the ATI extension that have been promoted to core:
Just use the core feature, it works everywhere.

It’s slightly different to that extension also, because that extension doesn’t include glStencilMaskSeparate equivalent, and StencilFuncSeparateATI operates differently:

StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);


StencilFuncSeparate( GLenum face, GLenum func, GLint ref, GLuint mask );

In the ATI version, it’s not possible to set ref + mask for each face separately.

The OpenGL registry http://www.opengl.org/registry/api/gl.spec lists StencilFuncSeparateATI as an alias for StencilFuncSeparate, but it’s not safe to use as one, although it’s easily done by mistake as they both have the same parameter layout.

Great, thanks for the detailed information!