Mouse projection

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?

hello, you have to use
gluProjection

i hope help you…

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

that is the operations !!! thanks !!!