Return to previous page | Return to menu Go to next page


Programmer’s Tutorial

camera

This chapter explains the definition of the camera and how to operate it.
A camera defines where in the 3D space and how to look around the space, and is also called a viewing transformation. The camera consists of three elements: viewpoint, line of sight, and angle angle. By changing these three elements, you can freely draw the space on the projection plane.

6-1. Camera definition and settings

There are two types of camera definitions and settings in SGL.

1) Fix the viewpoint to the origin and the line of sight to the Z axis, and move the object to obtain the desired video
2) Fix the object side and move the viewpoint and line of sight to obtain the desired video

To realize 1), it is necessary to add modeling transformation to all objects existing in the space.
To implement 2), use the library function “slLookAt”.

However, in the case of 2), the method of 1) is used internally, and the appearance camera appears to move freely in space.

If you want to make finer camera settings (not described here), use method 1). From the viewpoint of processing speed, 1) can change the viewpoint and line of sight more efficiently.


Return to previous page | Return to menu Go to next page