1) Setup
your tripod and point Camera at the scene. (Viewing Transformation)
2) Arrange
the scene to be photographed into the desired composition
3) Choose a
Camera lense or adjust the zoom (Projection Transformation)
4)
Determine how large you want the final photograph to be (Viewport
Transformation)
Pipeline
Process
object
coordinates - > Model View Matrix ->Project Matrix ->
Perspective
Division -> Viewport Transformation
glLoadIdentity();
gluLookAt(0.0,0.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
glLookAt(GLdouble
eyex, GLdouble eyey, GLdouble eyez,
GLdouble
centerx, GLdouble centery, GLdouble centerz,
GLdouble
upx, GLdouble upy, GLdouble upz);
eye :
coordinates of the viewer
center:
line of sight
up:
indicates which direction is up
glScalef(x
axis, y axis, z axis);
multiple
the LCA by a x,y,z scalar component
glTranslatef(x
vector component, y vector component, z vector component);
move
an object in x,y,z vector from an anchor point
glRotatef(x
vector component, y vector component, z vector component, angle);
rotate
an object object about an arbitrary vector
glViewport(0,0,(GLsizei)
w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
use
one of the following:
glFustrum
(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near,
GLdouble far);
*
calculates a matrix that accomplishes a perspective matrix
*
glFrustrum doesn't require a symmetric viewing volume.
gluPerspective(GLdouble
fovy, GLdouble aspect, GLdouble
near, GLdouble far)
*
Creates a matrix for symmetric perspective-view frustum and multiples the
current matrix by it.
*
fovy is on the x-z plane with an angle ranging from [0.0, 180.0]
glOrtho2d(GLdouble
left, GLdouble right, Gldouble bottom, GLdouble top);
*
Clipping region is a rectangle with lower-left corner at (left, bottom) and the
upper-right corner at (right, top)
The
projection transformation determines how objects are projected onto the screen.
-
Perspective makes objects that are further away appear smaller
-
Orthographic maps objects directly onto the screen without effecting their
relative size
-
glLoadIdentity is used to initialize the current
projection matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- The
viewport indicates the shape of the available screen area into which the scene
is mapped.
-
glViewport describes the origin of the available screen space within the window
As the scene is drawn,
OpenGL transforms each
vertex of every object in the scene by the Modeling and Viewing
Transformations.