The order in which you indicate vertices determine the clock-wise or anti-clock-wise orientation of that geometry (such as a triangle or a square etc). As you follow that winding see how a right-hand-screw will advance. The direction of the advance will tell you which surface is facing outwards and which surface is facing inwards.

Show images for: opengl winding images

It is quite instructional to see the image links above!!

The direction of the arrows are winding in anti-clock wise direction

So the face that from which the curling arrow comes out is the front face. the direction in which the screw advances as you loosen it in counter clock wise direction indicates the front of the surface. If you look at that surface from the other side then the screw will be moving away from the surface and that is the back side.

You can form a mental picture for each face and see how a screw will advance and which vertices need to come first to provide that anti-clock-wise rotation.

Typically OpenGL can hide back facing surfaces which is called CULLING

Search for: Typically OpenGL can hide back facing surfaces which is called CULLING

Here is a link to read more on this aspect


//paint front facing
//Use a surface
glPolygonMode(GL_FRONT, GL_FILL);

//paint back facing
//Only use outlines. don't fill the triangle
//just the perimeter
glPolygonMode(GL_BACK, GL_LINE);

GL_FRONT_AND_BACK, 
GL_FRONT, or 
GL_BACK

GL_POINT, 
GL_LINE, or 
GL_FILL

For example to draw a cube that is filled with color but also has distinct edges, you may want to draw it twice, first as a fill and then again as a line!!

Read this article on depth and hiding hidden surfaces


// Enable depth test
glEnable(GL_DEPTH_TEST);

// Accept fragment Or Draw a pixel
// if it closer to the camera than the former one
glDepthFunc(GL_LESS);