PDA

View Full Version : 3D coordinates from 2D raster position



HarryB
05-30-2003, 05:06 AM
Hi,
I am writing software to visualize 3D-triangulated objects. When a user moves the mouse over a vertex in the display, I want to get the information about which 3D object he/she is looking at.
I am thinking of using the glFeedbackBuffer option; but as far as I can see, the GL_FEEDBACK mode only gives me a listing of 2D raster positions of all polygons which were drawn. Some of them may have been clipped, so there may be fewer objects in the feedback buffer than originally drawn. In that case, I don't know anymore which 3D object corresponds to which 2D raster position. Can anyone give me a hint on how to relate the 2D raster positions to the original 3D ones?
Thanks a lot,
Harry

rgpc
05-30-2003, 05:36 AM
Have a look at my post in this (http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/009339.html) thread.

matt_weird
05-30-2003, 06:12 AM
i think selection buffer would help there(rgpc pointed it out in that post as well). if you have a single model in your scene, that would be even more simple: you're putting the vertex indexes into a name stack, and when the click happens, you just restore the vertex information from the model's vertex array.