PDA

View Full Version : Urgent help needed: mouse picking in OpenGL



Tony Chen
03-20-2001, 10:55 AM
for my current project, i need to fix the 2-D coordinates (3-D would be nicer) of a 3-D object in an OpenGL scene. i tried to use the 'gluUnProject' routine which works fine except when the object is rotated! Any insights deeply appreciated!

Tony

Randolph
03-20-2001, 12:33 PM
Please, write, what kind of coords you need - transformed or untransformed. If you need transformed coord, then use gluProject function. Otherwise, I dont understand why gluUnProject doesnt work. Maybe you got wrong PROJECTION, MODELVIEW or VIEWPORT matrices?

Tony Chen
03-20-2001, 12:51 PM
To Randolph:

Thanks for the reply! anyway what i want are untransformed coordinates.

I'm doing 3D human-body modeling in OpenGL. right now i need the ability to fix the original coordinates of a point on that body using the mouse. So far, i am able to do that as long as the object is not rotated (translation and zooming don't seem cause any problems!).

but once the object is rotated (eg. when i need to have a point on the back of the body), i get incorrect coordinates from 'gluUnProject'.

Thanks for any suggestions!

Tony

Tony Chen
03-20-2001, 01:34 PM
I solved the bug, its a human one: i accidentally pushed the rotation matrix off the stack.

Thanks anyway!