Cameras in OpenGL
I had assumed that having a camera in a 3D-graphics system was fairly elementary, until looking into walking-through a scene with OpenGL. The system does not contain a ‘camera’ object, but requires the entire scene to be rotated to simulate a moving viewport.
Initially, this seems to be a convoluted solution to a simple problem, but it is almost certainly a performance issue. OpenGL using interactive (rather than Ray Traced) rendering needs a strong idea of where objects are with respect to the camera. If the camera were to be moved, it would be likely that the OpenGL system would have to rotate the whole scene to achieve the effect, and therefore is trying to be a little more transparent.
The GLu library provides a useful helper function gluLookAt(...) to calculate the transformation matrix which is all well and good. However, trying to achieve ‘common’ camera effects with this rough interface is a challenge, involving lots of vector algebra and nasty code.
I have created a C library which implements a Camera-like ‘object’ on top of the functionality provided by GLu. This is currently pre-beta and totally undocumented – an updated version should be available soon:

Comment
Commenting is closed for this article.