Overlaying graphics onto camera image

How can configure OGL so that computer generated graphical objects are correctly registered with an image coming from a camera?

The question is related to an augmented reality system where camera position and orientation are known, along with the real world “positions” of the virtual graphics. With correct registration, the virtual objects will seem to be attached to real objects when the camera moves.


Set your projection matrix with glFrustum or gluPerspective to match the camera’s lens.
Position your modelview matrix to have the same position and orientation as your camera.