Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: pixel to vertex data

  1. #1
    Guest

    pixel to vertex data

    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?

  2. #2
    Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    322

    Re: pixel to vertex data

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •