PDA

View Full Version : Get object coordinates from mouse



Subespaciovectorial
January 22nd, 2009, 06:21 PM
Hey guys. I have a code in c++ that makes a cube in OpenGL with many atoms (spheres) inside. I want to obtain the coordinates of an atom from the MouseFunction and it seems to be that glUnProyect is the best way to do it, but I don't know how to use it. Can someone give me some short example of glUnProyect for OpenGL? Thanks.

Some data: The scene is drawn with the gluPerspective proyection and (if you press the 'o' buttom) with the glOrtho perspecive.