Mouse coordinates to World Coordinates

New Message Reply Date view Thread view Subject view Author view

Kevin Kronmiller (kkronmil++at++metricsys.com)
Wed, 2 Jun 1999 10:16:12 -0500


Hi,

I have a performer application that I am having some trouble with. I want to return the Latitude and Longitude based on mouse location over the terrain.

I am using the following code in a draw callback. I also am using an Orthographic view to present a "God's Eye" view of the terrain.

glGetDoublev(GL_PROJECTION_MATRIX, projView);
glGetDoublev(GL_MODELVIEW_MATRIX, modelView);
glGetIntegerv(GL_VIEWPORT, view);

gluUnProject(winX, winY, winZ, modelView, projView, view, &objX, &objY, &objZ);

I would like to use the pfu routines but mouse processing is handled by another process and the winX and winY values are passed to me. I am using 0.0 for winZ because I am not given a value. objX and objY both contain appropriate values. The value for objZ is unreasonably large.

The above code works for objX and objY until I translate my viewpoint in Y. Translating in X works OK. I would like to use the pfu routines but mouse processing is handled by another process.

My questions:

1. Is this the proper way to convert from window coordinates to world coordinates?
2. What value should I use for winZ in the gluUnProject() call?
3. Can anyone point me to some sample code?
4. Am I missing something obvious?

Any ideas are greatly appreciated.

Thanks for your time
Kevin Kronmiller

kronmiller++at++metricsys.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Wed Jun 02 1999 - 08:17:14 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.