+ gluLookAt(eyePos[0], eyePos[1], eyePos[2],
+ 0, 0, 0,
+ 0, 0, 1);
+}
+
+void updateView()
+{
+ updateView(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
+}
+
+void glReshapeFunc(int width, int height)
+{
+ updateView(width, height);
+}
+
+void glMouseFunc(int button, int state, int x, int y)
+{
+ if (button == 3 && state == 0)
+ {
+ view.lookRadius += view.lookRadius*0.1;
+ updateView();
+ }
+
+ else if (button == 4 && state == 0)
+ {
+ view.lookRadius -= view.lookRadius*0.1;
+ updateView();
+ }
+
+ else if (button == 0 && state == 0) {
+ view.fstMouseAngle[0] = x;
+ view.fstMouseAngle[1] = y;
+ view.oldLookAz = view.lookAz;
+ view.oldLookAlt = view.lookAlt;
+ }
+
+}
+
+void glMotionFunc(int x, int y)
+{
+ view.lookAlt = fmod(view.oldLookAlt +
+ (float)((y-view.fstMouseAngle[1])*2*M_PI/glutGet(GLUT_WINDOW_HEIGHT)),
+ (float)(2*M_PI));
+
+ view.lookAz = fmod(view.oldLookAz +
+ (float)((x-view.fstMouseAngle[0])*2*M_PI/glutGet(GLUT_WINDOW_WIDTH)),
+ (float)(2*M_PI));
+
+ updateView();