PDA

View Full Version : How to not show something in back of object



DJKAOS
06-04-2001, 11:30 AM
Hi, I have a Sphere that I created with
glutSolidSphere, and on that sphere there is some cyllinders that I put on it, however when I rotate the entire object the Cylinders show up at all times, even when they should be "behind" the sphere, you can see them through the sphere...How do I stop it from doing this?

I tried
glEnable(GL_CULLING);
glCullFace(GL_BACK);

and that didn't seem to do anything..

Thanks for any help.

fathom
06-04-2001, 05:22 PM
Did you set up your Depth Buffer correctly?

glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

and of course, make sure you've allocated bits to it via the pixel format call or in case of GLUT, with the GLUT_DEPTH call in your glutInitDisplayMode()

DJKAOS
06-04-2001, 07:39 PM
Hi I didn't have the GLUT_DEPTH in there, but I had everytyhing else...
now that I added GLUT_DEPTH my Linux is giving me the same problems as the Windows one is.

its probably some dumb mistake, I just cant find it.

DJKAOS
06-04-2001, 07:45 PM
Nevermind, I figured it out, I was not
clearing my GL_DEPTH_BUFFER_BIT
I fixed that so it works now.