yRot = (float)(y - WinHeight/2) / scale;
identity(rot);
rotate_xy(rot, yRot, xRot);
+ glutPostRedisplay();
}
}
void
mouse(int button, int state, int x, int y)
{
- if(state == GLUT_DOWN)
- {
- mouseGrabbed = !mouseGrabbed;
- }
+ mouseGrabbed = (state == GLUT_DOWN);
}
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMouseFunc(mouse);
- glutPassiveMotionFunc(drag);
+ glutMotionFunc(drag);
glutIdleFunc(Draw);
Init();
glutMainLoop();
static int Win;
static int WinWidth = 256, WinHeight = 256;
-static int mouseGrabbed = 0;
+static GLboolean mouseGrabbed = GL_FALSE;
static GLuint vertShader;
static GLuint program;
float rot[9] = {1,0,0, 0,1,0, 0,0,1};
yRot = (float)(y - WinHeight/2) / scale;
identity(rot);
rotate_xy(rot, yRot, xRot);
+ glutPostRedisplay();
}
}
void
mouse(int button, int state, int x, int y)
{
- if(state == GLUT_DOWN)
- {
- mouseGrabbed = !mouseGrabbed;
- }
+ mouseGrabbed = (state == GLUT_DOWN);
}
glutDisplayFunc(Draw);
glutIdleFunc(Draw);
glutMouseFunc(mouse);
- glutPassiveMotionFunc(drag);
+ glutMotionFunc(drag);
Init();
glutMainLoop();
return 0;