3d images

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?

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

Yes…I just tried it out and it worked. Thanks A lot )