View Full Version : how to hide back faces of a cube
03-25-2002, 02:43 PM
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.
03-25-2002, 03:06 PM
03-25-2002, 03:32 PM
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.
03-25-2002, 04:11 PM
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).]
03-26-2002, 10:20 AM
Yeah, order your points on the cube in either a clockwise or anticlockwise manner (ie when you call them to be drawn)
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.