X,Y coordinates of a point on a 3d plane...

I know I am over thinking this which is why I am here.

I have a very simple program where I create a glRect(0,0,6,6), then rotate it about 80 degrees on the Y axis.

Then on MouseMove i use glUnProject()/glReadPixels() method to get the position on the plane and then draw it with another rect.

Here is an example of the output:

Mouse is hovering over the bottom right of the plane:
[ATTACH=CONFIG]401[/ATTACH]
Mouse is hovering over the upper left of the plane:
[ATTACH=CONFIG]402[/ATTACH]
Mouse is hovering over the upper right of the plane:
[ATTACH=CONFIG]403[/ATTACH]

So, what I would like to get is WHERE that point is on the rect/plane. So if the rectangle was drawn glRectf(0,0,6,6) and the mouse is over the upper right (like the 3rd picture), then how would I take the point (returned by glUnproject()) and convert back it to ~(6,6)

Thanks in advance for any info you can give me on doing this.

-andy.

I think I may have a theory – and it seems to be checking out (but only in small preliminary tests).

Is this how you would tackle it:

  1. Get the click coordinates using the tried and true gluUnProject method.
  2. Get an Inverted MODELVIEW matrix
  3. Multiply the click coordinates by the inverted MODELVIEW matrix

This should be the proper way to do this, correct?