/* Trackball Handler */ void trackball_handler(int event,int xx,int yy) { float matrix[4][4]; if ( event == FL_PUSH ) { x_ang = xx ; y_ang = yy ; trackball.rotate( 0,0,0,0 ) ; } else if (( event == FL_DRAG ) ) { trackball.rotate((2.0 * x_ang - screen_width) / float(screen_width), (screen_height - 2.0 * y_ang) / float(screen_height), (2.0 * xx - screen_width) / float(screen_width), (screen_height - 2.0 * yy) / float(screen_height)); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); trackball.rotationMatrix(matrix); glMultMatrixf((float *)matrix); x_ang = xx ; y_ang = yy ; glutPostRedisplay() ; } }