PDA

View Full Version : Mouse projection



JeeTriX
04-26-2002, 01:21 AM
Hello,

i don't really know if this is advanced but i don't find a lot of info on my problem.

I have a scene with a movable camera. The thing i want to do is to determine, if you click with the mouse on the glwindow, where (@ wich coordinates (x,y,0)) the projection of that point on the xy-plane is.

So, for example, if i would draw a cube at this point, then the cube should move over the xy-plane following the mouse.

I have tried to calculate it out of my camera's parameters but i don't seem to get it right.

I can't determine the direction of the projectionline from the mouse to the xy-plane because i don't know the distance between the real viewpoint and the projectionwindow.

I've seen this working in a lot of modelling applications but don't find any info on it.

anyone able to help?

J_Ramone
04-26-2002, 03:29 PM
hello, you have to use
gluProjection

i hope help you...

JeeTriX
04-29-2002, 03:07 AM
I can indeed transform the screen co÷rdinates with the gluUnProject() routine but it requires a depth range in relation to the clipping-planes of the viewport. that's a value that's hard to get in my scenario.

Anyway, i managed to calculate it with 4 goniometric operations and it works fine,
but thanks for the tip http://www.opengl.org/discussion_boards/ubb/smile.gif

IronRaph
04-29-2002, 07:56 AM
that is the operations !!! thanks !!!!!