Raetin
02-08-2001, 07:47 PM
Hi All!
Ok, so I just started out with OpenGL and (suprisingly) got it pretty much working right off the bat with the help of a few tutorials and such.
Anyway, what I've done so far is load in an OBJ file exported from 3DSMax with a few meshes inside, loaded the meshes, and rendered them, and rotated the scene around a bit. This worked fine, no probs.. except that everything was one color and I couldn't see anything but silhouettes..
Now I've added in some light to better see everything, and I'm noticing that I can VERY clearly see objects being drawn that are behind other objects. For example, seeing the innards of that teapot.. seeing a sphere behind a cube.. stuff like that..
What am I doing wrong as far as the ZBuffer goes? I'm writing this in GLUT and the only few mentions I have about the Depth buffer are the following:
///////////////
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
///////////////
Is there anything else I need to do as far as the zbuffer is concerned to stop having it draw objects that I should not be able to see?
Thank you!!
Raetin
Ok, so I just started out with OpenGL and (suprisingly) got it pretty much working right off the bat with the help of a few tutorials and such.
Anyway, what I've done so far is load in an OBJ file exported from 3DSMax with a few meshes inside, loaded the meshes, and rendered them, and rotated the scene around a bit. This worked fine, no probs.. except that everything was one color and I couldn't see anything but silhouettes..
Now I've added in some light to better see everything, and I'm noticing that I can VERY clearly see objects being drawn that are behind other objects. For example, seeing the innards of that teapot.. seeing a sphere behind a cube.. stuff like that..
What am I doing wrong as far as the ZBuffer goes? I'm writing this in GLUT and the only few mentions I have about the Depth buffer are the following:
///////////////
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
///////////////
Is there anything else I need to do as far as the zbuffer is concerned to stop having it draw objects that I should not be able to see?
Thank you!!
Raetin