Skip to main content
gamedev.net
🔒 Locked

Depth Problems

Started by abvenia 4 replies 350+ views
Original Post
abvenia
abvenia
I wrote a program that creates three spheres (representing 2 hydrogens and an oxygen) They rotate about the oxygen as dictated by the keyboard arrows. The problem is that even when one of the hydrogens should be in front of the oxygen; the the oxygen is drawn overtop of it. The Redbook told me I need to clear the depth buffer; but I''m already doing that. Heres a link to the code if anyone has any suggestions; thanks! http://www.angelfire.com/alt/cache/water.txt
abvenia
abvenia
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE|GLUT_DEPTH);
glDepthFunc(GL_LEQUAL);
glEnable(GL_CULL_FACE);
glClearDepth(10.0);
glEnable(GL_DEPTH_TEST);

I enabled the GL_DEPTH_TEST. I don''t know; I''m new to OpenGL; and the redbook just ain''t giving me answers right now...
rpg_code_master
rpg_code_master
try...

glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE|GLUT_DEPTH);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_CULL_FACE);
glClearDepth(10.0);
abvenia
abvenia
Just change the order? I gave it a go; no luck. Thanks anyway.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.