OpenGL OpenGL Transformations and Matrices 2 — Questions and Answers
Question 1: When transforming surface normals from object space to world space, why can you not simply use the model matrix?
- Normals use only 3 components
- Non-uniform scaling would distort normal directions (Correct answer)
- Normals must remain in eye space
- The model matrix only works on positions
Correct answer: Non-uniform scaling would distort normal directions
Non-uniform scale changes the angle of normals, so the correct transform is the transpose of the inverse of the model matrix.
Question 2: Which matrix converts a flat frustum-shaped view volume to a cube for perspective rendering?
- Orthographic projection matrix
- Perspective projection matrix (Correct answer)
- View matrix
- Scale matrix
Correct answer: Perspective projection matrix
A perspective projection matrix applies the 1/z depth foreshortening that makes distant objects appear smaller.
Question 3: What does the glViewport function define in OpenGL?
- The depth range for the depth buffer
- The rectangular window area on screen that NDC maps to (Correct answer)
- The field of view for the projection
- The camera's position
Correct answer: The rectangular window area on screen that NDC maps to
glViewport(x, y, width, height) sets the pixel region on the window where NDC space (-1 to 1) is mapped.
Question 4: Which OpenGL function sets the depth range mapping from NDC z to window z?
- glScissor
- glDepthRange (Correct answer)
- glClearDepth
- glDepthMask
Correct answer: glDepthRange
glDepthRange(near, far) remaps the NDC z range [-1, 1] to a custom window-space depth range, defaulting to [0, 1].
Question 5: What rotation representation avoids gimbal lock and is commonly used in 3D graphics for smooth interpolation?
- Euler angles
- Rotation matrices
- Quaternions (Correct answer)
- Axis-angle
Correct answer: Quaternions
Quaternions represent rotations in a compact 4D form that supports smooth SLERP interpolation without gimbal lock.
Question 6: What is the correct order to multiply matrices to transform a vertex from object to clip space?
- Model × View × Projection
- Projection × Model × View
- Projection × View × Model (Correct answer)
- View × Model × Projection
Correct answer: Projection × View × Model
The vertex is multiplied as Projection × View × Model × vertex_position, applying model first, then view, then projection.
When transforming surface normals from object space to world space, why can you not simply use the model matrix?