PDA

View Full Version : 3d images



hatemagnet
01-27-2002, 01:49 PM
Hi. I have a simple question (i'm just a begginner). I'm reading 3d objects in from a file. The objects are not ordered according to thier position, so when say, the second object is read in, it will appear on top of the first object just because It was drawn on top of the second object, rather than because it belongs in that position in space.

Is there a way to draw the objects so they appear correctly on the screen without having to sort them? Can someone please point me in the right direction?

chowe6685
01-27-2002, 04:26 PM
If I interpret you correctly, all you need to do is set up the depth test

glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
that should do what you want

hatemagnet
01-27-2002, 04:30 PM
Yes...I just tried it out and it worked. Thanks A lot http://www.opengl.org/discussion_boards/ubb/redface.gif)