View Full Version : Identifying a specific vertex

04-25-2014, 05:20 AM
If I mouse-click on s specific pixel, that will give me the x & y of the mouse, which is the projected location of the vertex which drew that pixel. Similarly, glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); will give me the location of that pixel along the Z axis of the camera range. The resulting coordinates are approximations of the original vertex coordinates, so I need to compare the calculated coordinates with the original list of vertices. For my small model, my calculated coordinates are within 0.1% of the original vertex coordinates, and life is good.

The Problem is that the model has been panned and rotated, so that I need to multiply the projected coordinates with the inverse of the transformation matrix. I can to that with one command in OpenCL. Is there a way to do that with OpenGL?