*/\r
void motion(int x, int y) {\r
if (moving) {\r
- zoomFactor += (x - startx);\r
- rotateFactor += (y - starty);\r
+ zoomFactor += (y - starty);\r
+ rotateFactor += (x - startx);\r
startx = x;\r
starty = y;\r
glutPostRedisplay();\r
glMatrixMode(GL_MODELVIEW);\r
glLoadIdentity();\r
\r
+ GLfloat zcoord = 5.0 + (zoomFactor*0.2);\r
+ if ( zcoord < 0.0 ) {\r
+ zcoord = 0.0;\r
+ zoomFactor = 0.0;\r
+ }\r
+\r
gluLookAt(\r
- 0.0, 0.0, 5.0 + (zoomFactor*0.2), /* eye is at (x,y,z) */\r
+ 0.0, 0.0, zcoord, /* eye is at (x,y,z) */\r
0.0, 0.0, 0.0, /* center is at (x,y,z) */\r
0.0, 1.0, 0.0 /* up is in postivie Y direction */\r
);\r
\r
- glRotatef(75.0, 1.0, 0.0, 0.0);\r
+ glRotatef(50.0, 1.0, 0.0, 0.0);\r
\r
/* Reposition the light source. */\r
lightPosition[0] = 12*cos(lightAngle);\r
glPushMatrix();\r
\r
/* Perform scene rotations based on user mouse/keyboard input. */\r
- glRotatef(rotateFactor*0.2, 0.0, 1.0, 0.0);\r
+ glRotatef(rotateFactor*0.5, 0.0, 1.0, 0.0);\r
//glTranslatef(camx, camy, camz);\r
//glRotatef(rot, 1.0, 0.0, 0.0);\r
\r