Hello, i have written a basic app based on the tutorials from learningwebgl.com. It draws a plane, then applies an image to it. Then you use the mouse to pan and zoom. Basically an image viewer similar to that used in picasa.

My problem happens during the mouse move functions and getting screen pixels into scene space. When moving the mouse it pans ok, but its off a little bit, not 1:1, and i assume its due to the perspective?

i set my projection matrix by using the makePerspective function in glUtils from learningwebgl.com:

Code :
perspective(45.0, width / height, 0.1, 100.0);

and my model view matrix with:
Code :
lookAt(0.0,0.0,5.0,
          0.0,0.0,0.0,
          0.0,1.0,0.0
);

the function for handling the mouse move is:
Code :
var angle = 90 / 2;
var x = (5 * (90 - angle)) / angle;
var dx = ((e.client.x - last.x) * (x /width));
 
eye.x += -dx;
center.x += -dx;
last.x = e.client.x;

is my math even close to correct here?

Thanks, this is exciting stuff!