PDA

View Full Version : pixel to vertex data



06-22-2005, 08:11 AM
I need to access data linking a pixel on the rendered image to the vertex or closest vertex in the 3D model from which it was rendered. I don't know if this is a begginner's question or not, but I am definetly new the openGL. Is there any support for this sort of thing?

T101
06-22-2005, 09:49 PM
I haven't done this myself, but I think you'd have to do the following:

1. Render the scene for feedback mode - with separate IDs per triangle (or object)
2. Use gluUnproject on the pixel you're interested in. This should give you an approximation of the 3D position of the pixel.
3. Retrieve the pixel's object ID
4. Cycle through all vertices belonging to the triangle (or object), and pick the nearest.