   Wireframe cube - hidden line removal failing
  Hi all,I'm having this incredibly annoying problem. All I'm trying to do is render a white wireframe cube, but with hidden line removal *working*. Sadly, my efforts so far just aren't coming out quite right. In fact, it appears that the lines being HIDDEN are the very lines which should be the ones being DRAWN. So the resulting cube basically appears "back to front".Here is the relevant code snippet I'm using at the moment, and I've put in some comments to try and make thinks a little clearer:----------glEnable(GL_DEPTH_TEST);glFrontFace(GL_CW);//glFrontFace(GL_CCW); // NOTE this leads to totally weird psychedelic screen-wide effects.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);glLineWidth(2.0);glColor4f(1.0, 1.0, 1.0, 1.0); // NOTE colour set to white.glPushMatrix();glTranslatef(gvboresight.y, -gvboresight.z, -gvboresight.x);gsc = sqrt(gq1albe.x * gq1albe.x + gq1albe.y * gq1albe.y + gq1albe.z * gq1albe.z);glRotatef(2 * acos(gq1albe.w) * RADTODEG, gq1albe.y / gsc, -gq1albe.z / gsc, -gq1albe.x / gsc);glutSolidCube(0.4); // NOTE glut SOLID cube used.glPopMatrix();glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);glEnable(GL_POLYGON_OFFSET_FILL);glLineWidth(2.0);glColor4f(1.0, 1.0, 1.0, 0.0); // NOTE alpha channel set to 0.glPushMatrix();glTranslatef(gvboresight.y, -gvboresight.z, -gvboresight.x);gsc = sqrt(gq1albe.x * gq1albe.x + gq1albe.y * gq1albe.y + gq1albe.z * gq1albe.z);glRotatef(2 * acos(gq1albe.w) * RADTODEG, gq1albe.y / gsc, -gq1albe.z / gsc, -gq1albe.x / gsc);glutSolidCube(0.4); // NOTE glut SOLID cube used again - as I believe is correct?glPopMatrix();glDisable(GL_POLYGON_OFFSET_FILL);----------One extra thing I should mention is that you'll notice there's a conversion within the code so that I can work in quaternions (see use of the variable 'gsc'), but I don't see how this can foul things up. It works perfectly for eveything else I do.Any help much appreciated!Prosper (Anthony)   
  Well, first things first. What you are doing is a waste of time.You are just rendering a cube, so rendering it with wireframe mode is enough if you want hidden line removal.Backface culling will take care of the lines that should be hidden.Normally, a GL program would use glFrontFace(GL_CCW)and glEnable(GL_CULL_FACE) and glCullFace(GL_BACK)Why use glut? Just dump that thing.   ;  V-man,You asked why use glut anyway? Well, I've been giving it some thought, and shucks, well, I think I've come up with a couple of answers - so let's run them up the old flagpole and see who salutes, yeah?Option 1) I guess I'm a man of notoriously intemperate disposition and simply given over to wickedness.Option 2) I just wanted to try out glut and see what it offers.Answers on a postcard please,Best regards,Prosper (Anthony)PS: I'd be most grateful if someone ELSE might be able to help me out of my glut-related dilemma!:)   ;  As v-man said you should enable backface culling and specify what face to cull (glCullFace(GL_BACK)).Then you are also rendering a second cube with alpha = 0. Why that? Quote:glEnable(GL_POLYGON_OFFSET_FILL);....glDisable(GL_POLYGON_OFFSET_FILL);Where's the glPolygonOffset call?Quote:glutSolidCube(0.4); // NOTE glut SOLID cube used.I assume you want to use glutSolidCube (AFAIK there's also a glutWireCube or something like that).   ;Quote:Original post by prosperglEnable(GL_DEPTH_TEST);glFrontFace(GL_CW);//glFrontFace(GL_CCW); // NOTE this leads to totally weird psychedelic screen-wide effects.Your first step in making it work is to understand this problem. Take this as an hint.Also, I don't see any DepthFunc call. For HSR, you need to use you Zbuff.have you tried drawing your scene twice, the first time with color writes off and then with DepthFunc(EQUAL)?   