PDA

View Full Version : Select only visible faces (discarding the hidden)



mauro
09-10-2000, 11:24 PM
I've perform a selection, on my triangulated model, through
gluPickMatrix(..), but my problem is that also the back faces are picked and I don't know how can quickly remove them from my hitbuffer.
My idea is to perform some hidden surface algorithm on the triangles hitted but this cause a postprocessing.
I ask me if there is some method that immediately give me only the faces displayed in front.
Is there somebody who can help me?

Relic
09-11-2000, 02:19 AM
You could enable face culling (glEnable(GL_CULL_FACE)) in OpenGL to discard the backfaces, but you'll have to find the nearest z value in the selection buffer anyway, if you have concave geometry or multiple objects.

A completely different way for picking (but faster because HW accelerated and pixel precise) way would be to draw all faces without lighting with flat shading in a unique color (ID), looking up the color on the screen, and decoding the ID from the color. This works only in truecolor, or carefully used in highcolor without dithering.