Getting Projection and ModelView matrices

New Message Reply Date view Thread view Subject view Author view

Tom Flynn (thomas.a.flynn++at++boeing.com)
Mon, 19 Apr 1999 17:08:03 -0400


Greetings,

Background
---------
We're implementing a little utility for ourselves to measure distance
between two points at the click(s) of a mouse (note: we're using an
orthographic viewing projection when "measuring"). Given the
coordinates of where the mouse is on the screen (found via
XQueryPointer()), we find the associated world coordinates via
gluUnProject(). Works great....in the draw process.

Problem
-------
gluUnProject() requires the Projection and ModelView matrices as input
(as well as a couple other things that we already know). In the draw
process, I can do a:

  glGetDoublev(GL_PROJECTION_MATRIX, projMatD);
  glGetDoublev(GL_MODELVIEW_MATRIX, modelViewMatD);

to get the matrices and then do the gluUnProject(). Life is
fine...except that I really would prefer not to do this in the draw
process. I'd rather avoid setting up a draw callback (just for this)
and IPC mechanisms to command that draw callback to get the matrices and
return world coordinates. Yes, I've already done this, but I'd prefer
to eliminate all that code by getting the matices in the app process and
doing everything there. I've tried getting the matrices with:

  pfGetProjMat(); or pfGetFrustGLProjMat(); for the Projection matrix
and
  pfGetChanOffsetViewMat() for the ModelView matrix

and get unreliable results.

The Question
----------
Am I using the wrong calls? Or can this just not be done from the app
process?

Thanks in advance,
tom


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Apr 19 1999 - 14:06:38 PDT

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