2
* Simple trackball-like motion adapted (ripped off) from projtex.c
3
* (written by David Yu and David Blythe). See the SIGGRAPH '96
4
* Advanced OpenGL course notes.
9
* o call tbInit() in before any other tb call
10
* o call tbReshape() from the reshape callback
11
* o call tbMatrix() to get the trackball matrix rotation
12
* o call tbStartMotion() to begin trackball movememt
13
* o call tbStopMotion() to stop trackball movememt
14
* o call tbMotion() from the motion callback
15
* o call tbAnimate(GL_TRUE) if you want the trackball to continue
16
* spinning after the mouse button has been released
17
* o call tbAnimate(GL_FALSE) if you want the trackball to stop
18
* spinning after the mouse button has been released
26
tbInit(GLUT_MIDDLE_BUTTON);
32
reshape(int width, int height)
34
tbReshape(width, height);
44
. . . draw the scene . . .
50
mouse(int button, int state, int x, int y)
52
tbMouse(button, state, x, y);
64
main(int argc, char** argv)
68
glutReshapeFunc(reshape);
69
glutDisplayFunc(display);
71
glutMotionFunc(motion);
84
tbInit(GLuint button);
90
tbReshape(int width, int height);
93
tbMouse(int button, int state, int x, int y);
96
tbMotion(int x, int y);
99
tbAnimate(GLboolean animate);