PDA

View Full Version : overlapping polygons



cosmicGirl
02-14-2003, 08:19 AM
i am trying to draw sd shapes from the data file ( where they are being defined) and they consist of polygon primitives.
my question is that often times the polygons overlap and the faces that are in the back get drawn in the front
how do i avoid that?
thanx a bunch

jebus
02-14-2003, 08:22 AM
one way would be to order the polygons so that you draw them from back to front, and then draw them that way. this may be extremely difficult to do, depending on how the data is set up.

jebus

cosmicGirl
02-14-2003, 11:30 AM
thanks, i thought about that but some of the shapes are pretty complicated and i think there should be another way of doing it....maybe through some OpenGL routines???

shinpaughp
02-14-2003, 11:55 AM
Use glEnable(GL_DEPTH_TEST) in your intitialization and in your rendering loop glClear(... | GL_DEPTH_BUFFER_BIT) where ... could also include color, accum, and/or stencil buffer bits.