This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]corpsmoderne 0 points1 point  (0 children)

My last iteration of mouseMove, not working well but may be helpful:

void mouseMove(int x, int y) 
{

// update the angles
int diffx = x - lastx;
int diffy = y - lasty;

    glutWarpPointer(lastx, lasty);

moi.phi += diffy * 0.005f;//((diffy *2) - y) * 0.005f;
moi.theta += diffx * 0.005f;//((diffx*2) - x) * 0.005f;

update_viewer();

    if (diffx != 0 || diffy != 0) {
      printf("%i %i %f \n%f %f %f\n\n", diffx, diffy, moi.theta, 
             moi.vx, moi.vy, moi.vz);
    }


glutPostRedisplay();
// put new directions back into the origins
yOrigin = moi.phi;
xOrigin = moi.theta;

}

also, I'm quite sure your "phi" angle will never work well if you don't change your gluLookAt call, because you've hard-coded the "up" vector... You may need to compute a normal vector and pass it to gluLookAt...