In Review
Prev | Chapter 4. Objects at Rest | Next

## In Review

In this tutorial, you have learned about the following:

- Face culling can cause triangles to be culled (not rendered) based on the order of the vertices in window space.

- Perspective projections are used to give a scene the appearance of depth, where objects farther away appear smaller and offset compared to near ones. OpenGL hardware has special provisions for perspective projections; namely the transform from clip-space to NDC space division by W.

- The perspective transformation can be performed as a matrix multiplication operation. Matrix/vector multiplication is a way to compute multiple linear equations in a single operation.

- The proper aspect ratio for a display image can be maintained by scaling the X and Y coordinates of camera-space vertices based on the window's aspect ratio. This transformation can be folded into the perspective projection matrix.

### Further Study

Try doing these things with the given programs.

- In all of the perspective tutorials, we only ever had a frustum scale of 1.0. Adjust the frustum scale and see how it affects the scene.

- Adjust the zNear distance, so that it intersects with the prism. See how this affects the rendering. Adjust the zFar distance similarly and see what happens.

- We made some simplifying assumptions in our perspective transformation algorithm. In particular, we fixed the eye point at (0, 0, 0). and the plane at (0, 0, 1). However, this was not strictly necessary; we could have altered our perspective transform algorithm to use a variable eye point. Adjust the ShaderPerspective to implement an arbitrary perspective plane location (the size remains fixed at [-1, 1]). You will need to offset the X, Y camera-space positions of the vertices by Ex and Ey respectively, but only after the scaling (for aspect ratio). And you will need to divide the camera-space Z term by -Ez instead of just -1.

- Do the above, but in matrix form. Remember that any terms placed in the fourth column will be added to that component, due to the multiplication by Wcamera (which is always 1.0).

### OpenGL Functions of Note

glEnable/glDisable

  These functions activate or inactivate certain features of OpenGL. There is a large list of possible features that can be enabled or disabled. In this tutorial, `GL_CULL_FACE` was used to enable/disable face culling.

glCullFace/glFrontFace

  These two functions control how face culling works. `glFrontFace` defines which triangle winding order is considered the front. `glCullFace` defines what face gets culled. This function can also cull all faces, though this is not useful if you want to get rendering done.

  These functions only do something useful if `GL_CULL_FACE` is currently enabled. They still set the values internally even if `GL_CULL_FACE` is not enabled, so enabling it later will use the up-to-date settings.

Prev | Up | Next
Aspect of the World | Home | Glossary