Our main goal for the head tracking, is to render the virtual world in perspective with the positions of the eyes. If the eyes are moving the perspectives of the virtual world must be changed in a way the person thinks he is looking into a "virtual window". To make a virtual world we use a view frustum. A view frustum is the region of space in the modeled world that may appear on the screen. The frustum is a pyramid from the view point to the far plane. The pyramid is truncated at the near plane, hence the name frustum. Only the things between in the pyramid between the near and far plane is visible from the viewpoint. In the figure below you see a scheme of the frustum. \begin {center} \includegraphics[width=99.7mm]{img/frustumscheme.png} \\ Figure 5: A scheme of a frustum. \end {center} In the next figure you see the objects which can be viewed by the view point. The green object can be seen totally, the yellow partially and the red object can't be seen. \begin {center} \includegraphics[width=81.5mm]{img/frustumobjects.png} \\ Figure 6: The object which can be seen by the viewpoint. \end {center} If the viewpoint is moving, the frustum will be different. We use the the glFrustum function of the OpenGL library to set the frustum at his new values. This is a function who multiply the current matrix with a perspective matrix. \\\\ The specification of glFrustum is as follows: \begin{verbatim} void glFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar ) \end{verbatim} The parameters left and right will specify the coordinates for the left and right vertical of the near plane. The parameters bottom and top will specify the coordinates for the bottom and top horizontal of the near plane. The zNear, zFar Specify the distances to the near and far depth clipping planes. To calculate the left, right, bottom en top we use the coordinates of the persons eyes. How the coordinates are retrieved and calculated to the world values can be read in the previous chapter. We now set a frustum with the near clipping plane at $(-1/2 world width, -1/2 world height, 0), (1/2 world width, 1/2 world height, 0)$ with the eye at position \emph{(Eye Coordinate X, Eye Coordinate Y, Eye Coordinate Z)}. But because OpenGL expects the eye at position \emph{(0,0,0)} when specifying a frustum, we have to specify our near clipping plane with \emph{(- Eye Coordinate X, - Eye Coordinate Y, - Eye Coordinate Z)} as its origin, and translate the modelview matrix to \emph{(- Eye Coordinate X, - Eye Coordinate Y, - Eye Coordinate Z)} , such that the world origin is in the center of the screen. In order to allow objects to appear in front of the screen we move the near clipping plane closer to the eye position, without changing the frustum. Below you see the demo application of the head tracking technique. \begin {center} \includegraphics[width=100mm]{img/HeadTrackScreenShot.png} \\ Figure 7: The head track demo application. \end {center}