PDA

View Full Version : gluUnProject



Carlos
12-01-2000, 06:36 AM
I want to draw an object exactly where the user clicked with the mouse, so I need to convert the x,y window coordinates plus the z depth into xyz object 3D coordinates. I suppose the standard way of doing this is to use the gluUnProject function, which requires the viewport, modelview and projection data, plus the x,y,z window coordinates.

I am using Mesa 3.0 and Mesa 3.4, and the problem is,
I keep obtaining weird values for x,y object coordinates (the z coordinate seems all right). I am sure the viewport and projection information is right, and I am almost sure the modelview data is also ok. I am using a perspective projection, and so far I am not changing the default depth values (no DepathRange calls). The blue book talks about gluUnProject4, to be used when near is different from 0 and far is different from 1, which is defined only in GLU 1.3...

Could someone show me the light? This is a long standing problem for me, and hits me because the natural way of creating some objects cannot work without this. Thanks for all help!

Carlos

Carlos
12-01-2000, 09:49 AM
I found the problem, a type conversion or something...