Graphics Flashcards
What is a frame buffer?
A memory space that stores a grid
What is double buffering?
Where the front buffer’s image is being displayed on screen, and the back buffer contains the image that is currently being rendered. Then you swap the two buffers so the image that was being rendered earlier is now being displayed. WebGL does this for you automatically.
Vertex shader vs fragment shader
Vertex shader: The programmable shader that handles the processing of individual vertices
Fragment shader = pixel shader: takes care of how the pixels between the vertices look
Vertex Buffer Objects
Contain the data WebGL needs to describe the geometry that will be rendered
Index Buffer Objects
Contain integers that are used as references pointing to data in VBOs, in order to enable the reuse of the same vertex
Local coordinates and world coordinates
Each object in a 3D space is constructed on a dedicated coordinate system, and the purpose of this is to reduce complication for 3D scene construction. Then we apply the model transform which gives us the world coordinates (the single coordinate system for all objects in the scene). The view transform gives us the inverse, turning the world coordinates into view coordinates.
Perspective projection vs orthographic projection
Perspective: near and far planes of frustum are different
Orthographic: near and far planes are the same
View frustum
Name of the visible region, defined by six planes: near/far, top/bottom, right/left.
Viewport transform
The viewpoint transform maps the projected view to the available space in the computer screen (canvas).
Scaling operation
(a, 0 | 0, b)
Anticlockwise rotation
(cos, -sin | sin, cos)
Shear along x
(1, k | 0, 1)
Reflect in x-axis
(1, 0 | 0, -1)
Homogeneous coordinates
Coordinates in “projective space”. The W component scales all the others. If we have the homogeneous 2D coordinate (x, y, w), the Cartesian form is (x/w, y/w). Under homogeneous coordinates, 2D transformation matrices become 3D. Multiplying homogeneous coordinates by a scalar represents the same point as before.
Perspective transformation
Transforms each object so that the distant object appears smaller. The view volume in the shape of a frustum will become a regular parallelepiped.