Alterscapes

10-06-2009, 01:23 PM

I apologize in advance if this question is a bit muddled. I'm relatively new to advanced GL coding.

I'm using JOGL + the JOGL port of GLEEM to write an app. I want to implement a feature similar to the "Pan Hand" tool in Adobe Acrobat/Reader. I've defined a plane (right now it's the X,Y axes, but I'd like to keep my solution general). When the user clicks, I'm casting a ray onto this plane and determining the (x,y,z) ModelView coordinate that corresponds to the (x,y) screen position. When the user moves the mouse, I want to update the x and y entries of the base ModelView matrix s.t. the ray through the new (x,y) screen position still maps to the original (x,y,z) point on the plane in scene space.

My naive intuition about how to achieve this is to retrieve the ModelView, Projection, and Viewport matrices, then solve for the transform-x and transform-y entries in the ModelView matrix, given the new screen(x,y) and fixed scene(x,y,z) coordinates. Is there a way to exploit the capabilities of the fixed-function pipeline to do this without a bunch of math on the CPU?

I'm using JOGL + the JOGL port of GLEEM to write an app. I want to implement a feature similar to the "Pan Hand" tool in Adobe Acrobat/Reader. I've defined a plane (right now it's the X,Y axes, but I'd like to keep my solution general). When the user clicks, I'm casting a ray onto this plane and determining the (x,y,z) ModelView coordinate that corresponds to the (x,y) screen position. When the user moves the mouse, I want to update the x and y entries of the base ModelView matrix s.t. the ray through the new (x,y) screen position still maps to the original (x,y,z) point on the plane in scene space.

My naive intuition about how to achieve this is to retrieve the ModelView, Projection, and Viewport matrices, then solve for the transform-x and transform-y entries in the ModelView matrix, given the new screen(x,y) and fixed scene(x,y,z) coordinates. Is there a way to exploit the capabilities of the fixed-function pipeline to do this without a bunch of math on the CPU?