Game Development Reference
In-Depth Information
h are the screen width/height respectively), but this can be used to define whatever
viewport is required.
The glViewport () function should be called each time when FreeGLUT calls the
Reshape() function, which is called every time when the window size changes,
passing us the new height and width. It's also called once when the application is
first launched.
In order to maintain data for our camera, we will keep the following member variables
in our application class so that we can refer to them as needed:
btVector3 m_cameraPosition;
btVector3 m_cameraTarget;
btVector3 m_upVector;
float m_nearPlane;
float m_farPlane;
Note
Throughout this topic we will be using Bullet's built-in vector, quaternion, and
matrix classes for our 3D mathematics to spare us from having to build our own
from scratch.
Meanwhile, the code to update our camera is called within the Idle() function. The
comments in the chapter's source code will explain the details of this function. If any
of the commands in the UpdateCamera() function don't make much sense, then
go back to the start of this section and refamiliarize yourself with the purpose of the
various gl- commands, when the FreeGLUT callback functions are triggered, and
how they are used.
Search WWH ::




Custom Search