CullState documentation problem?

On CullState, the documentation says:

    /** Only the front sides are shown. */
    public static final int CS_FRONT = 1;
    /** Only the back sides are shown. */
    public static final int CS_BACK = 3;

Except the behaviour is the opposite. Is this a documentation problem, or an implementation problem? :)

that depends on the triangle winding of your model. If its Counter Clockwise, they are correct. If they are clockwise, the back becomes front and front becomes back…

Its an OpenGL thing…


As DP said… it’s subjective to what the definition of front and back. In OpenGL front is the side the normal faces. AND (the big and) the side the normal faces is dependant on the winding of the vertices. Because OpenGL is a Right Handed coordinate system, the normals are calculated on a counter clockwise rotation. The model you are using could have been built for a Left Handed Coordinate system (DirectX for instance), and the triangle indices could be clockwise.

Sorry, should have explained better ://

The code in LWJGLCullState says:

         switch (getCullMode()) {
         case CS_FRONT:
         case CS_BACK:
         case CS_NONE:

Whereas the docs for glCullFace say:

glCullFace -- specify whether front- or back-facing facets can be culled

void glCullFace(GLenum mode)


Specifies whether front- or back-facing facets are candidates for culling. Symbolic constants GL_FRONT and GL_BACK are accepted. The default value is GL_BACK.

So setting cullMode on the CullState to CS_FRONT will cull front faces, whereas the documentation for CS_FRONT says it will show front faces.

Or have I misread something somewhere? Sorry if I'm making an idiot of myself :)

Yep, you are right, there was a misdocumentation there. Fixed and committed.