chapter 4.4

Virtual Trackball

Objectives


Physical Trackball


A Trackball from a Mouse


Trackball Frame


Projection of Trackball Position


Reversing Projection


Computing Rotations


Using the cross product


Obtaining the angle


Implementing with GLUT

Example


In this example, we use the virtual trackball.c to rotate the color cube we modeled earlier
The code to examine is


//Initialization
//The Projection Step
//glutMotionFunc (1)
//glutMotionFunc (2)
//Idle and Display Callbacks

//Mouse Callback

//Start Function
//Stop Function

Better Trackball code can be found in underwater.c in the mouse and motion callbacks.


Quaternions