GL PROJECTION
lastmod 2024-11-17created 2024-11-172 edits
Among the transformations that take place in the OpenGL rendering pipe,
- "affine transformation" and
- "projection transformation"
are included.
- An affine transformation refers to transformations such as translation, rotation, and scaling of vertices; its characteristic is that it preserves the parallelism and ratios from before the transformation.
- A projection transformation, given n > m, is a transformation that maps a point in n-dimensional space to a point in m-dimensional space. An example is transforming a 3D point p(x, y, z) into a 2D point p'(x, y).
In the OpenGL rendering pipeline, the "projection transformation" happens after the "affine transformation".
Functions used for affine transformations include
- glTranslatef()
- glRotatef()
- glScalef()
- and so on, and
functions used for projection transformations are
- glOrtho()
- glFrustum(), and
- gluPerspective() is a function that makes glFrustum() easier to use.
Projection transformation in OpenGL comes in 2 kinds: one is "orthographic projection" and the other is "perspective projection".
To do any other kind of projection, create a custom projection matrix and put it on top of the current projection matrix stack using the glMultMatrix() function.
See also
- OpenGL
- GL_PROJECTION
- glMultMatrix
- glOrtho
- glFrustum
- gluPerspective