I'm having trouble converting pixel coordinates from the mouse to a 3D frustum. I'm using code similar to glProject() on OGL ES 1.1 . I have tried using glUnProject() but I couldn't get the vector to work and I know there is an easier way to do this. I was hoping to be able to compare the 3D and 2D coordinates and figure it out but I have not succeeded. So here's what I know:
I am using a 3D Vertex from the polygon that is being picked:
-1.0,1.0,0.0
Then I convert it to pixels coordinates with glProject():
140.0, 259.0, 0.0
I then use the mouse pixel coordinates:
140.0, 220.0, 0.0
This is the part I can't figure out:
-1.0, -1.0, 0.0
I got the #3 coordinates from the coordinates of #4 but what I want to do is the opposite which is convert pixels to 3D.
All I really need to know is how far the mouse has been dragged in 3D coordinates from another 3D point.