Original Post
I am creating a 3D space game using glutMouseFunc(), and glutMotionFunc(). On left mouse drag I modify the thrust in the XY plane. On shift left mouse drag I modify the thrust in the XZ plane. However I cannot get the shift left mouse to work correctly. Heres my code: int stateK=0; glutMouseFunc(mouse); glutMotionFunc(mouseDrag); void mouse(int button, int state, int x, int y) { stateK = glutGetModifiers(); if(glutGetModifiers() == GLUT_ACTIVE_SHIFT) { tX = x; tZ = y; } else { tX = x; tY = y; tZ = 0; } } void mouseDrag(int x, int y) { if(stateK != GLUT_ACTIVE_SHIFT) { mX += (x - tX); tX = x; mY += (tY - y); tY = y; } else { mX += (x - tX); tX = x; mZ += (tZ - y); tZ = y; stateK=0; } glutPostRedisplay(); }