how to hide back faces of a cube

Hi,

I can always see the hidden (i.e. the back) faces of my cube. Could I make the back faces invisible? My GL_DEPTH_TEST is turned on. Thanks for your information.

Tony

glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);

Hi,

I tried different combinations: glDisable(GL_CULL_FACE), glEnable(GL_CULL_FACE), and when enabled, tried glCullFace(GL_BACK), glCullFace(GL_FRONT). They all produce different views, but none of them can hide the back faces. Should I make the faces non-transparent somehow? Please help. Thanks.

Tony

You need to ensure that the faces have a consistent winding w.r.t. the inside vs the outside of the cube.

If you have a mix of clockwise & counterclockwise winding w.r.t. the cube inside vs outside then seemingly random faces will be culled.

[This message has been edited by dorbie (edited 03-25-2002).]

Yeah, order your points on the cube in either a clockwise or anticlockwise manner (ie when you call them to be drawn)

Then use

glFrontFace(GL_CCW); //or GL_CW for clockwise ordered points

To tell the program which are the front face sides to the squares of the cubes.