// Use motion of the mouse to animate void Interaction::mouseMotion(int x, int y) { if (mouseDown) { cur_x = x; cur_y = y; int distance = cur_x - last_x; // calculate the spin degree depends on distance spin_degree = distance * 0.01; spinDisplay(); spin_degree = DEFAULT_SPIN_DEGREE; } }
void learnView::Display() { #if 0 spinDisplay(); // xrotate = 45; LockGL(); // glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear ( GL_COLOR_BUFFER_BIT ); glColor3f(1.0, 1.0, 1.0); glLoadIdentity(); gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glScalef(1.0, 1.0, 1.0); glRotatef(xrotate, 1, 0, 0); glRotatef(yrotate, 0, 1, 0); DrawFrame(); glFlush(); //printf("calling swap buffers...\n"); SwapBuffers(); UnlockGL(); #endif }
void menu(int value) { switch (value) { case 0: direction = 0; spinDisplay(); break; case 1: direction = 1; spinDisplay(); break; case 2: direction = 2; spinDisplay(); break; case 3: direction = 3; spinDisplay(); break; case 4: direction = 4; spinDisplay(); break; case 5: direction = 5; spinDisplay(); break; case 6: break; case 7: exit(0); break; } printf ("X = %d, Y = %d, Z = %d\n", xrot, yrot, zrot); }