In this tutorial, you have learned about the following:
Vertex array objects encapsulate all of the state necessary to render objects. This includes vertex attribute arrays, buffer objects to feed those arrays, and the element buffer, if present.
Indexed rendering pulls data from the current vertex arrays by using a
separate sequence of indices. The sequence of indices defines the sequence that
OpenGL sees the vertices in. Indexed rendering can be performed by storing index
data in a buffer object, and using glDrawElements
.
Indices in indexed rendering calls can be offset by a value using the
glDrawElementsBaseVertex
function.
Hidden surface elimination can be performed by using a depth buffer and properly setting up the depth test.
Triangles that are outside of the camera zNear and zFar range are clipped against this range. This can open up holes in models if they are too close to the camera.
Clipping holes can be repaired to a degree by activating depth clamping, so long as there is no overlap. And as long as the triangles do not extend beyond 0 in camera space.
Creates/destroys one or more vertex array objects.
Binds a vertex array object to the GL_VERTEX_ARRAY
target.
Performs indexed rendering with the currently bound
GL_ELEMENT_ARRAY_BUFFER
(provided via the VAO)
and the current attribute arrays.
Performs indexed rendering as glDrawElements
,
except that each element index is offset by a constant value before
performing the array lookup. This is useful for minimizing the number of
buffer object binds performed in a program.
Enables/disables the per-fragment depth test. If the depth test is
enabled, then the result of applying the depth function, set by
glDepthFunc
, to the incoming fragment's depth
and the destination pixel's depth will determine if the incoming
fragment is written or not.
Sets or unsets the writing of values to the depth buffer.
Sets the depth comparison function for depth testing. Has no effect if
GL_DEPTH_TEST
is not enabled.
Sets the mapping between NDC space and window space for the Z
coordinate of the position. The XY counterpart to this function is
glViewport
. The range for the window-space
depth must be [0, 1], though the near does not have to be less than the
far. The range zNear value, the first value, is the window-space value
that will map to -1 in NDC space. The range zFar is the window-space
value that maps to +1 in NDC space.
Sets the clear depth value. This is the value that the depth buffer
will be cleared to when calling glClear
with the
GL_DEPTH_BUFFER_BIT
bit set.
Enables/disables depth clamping behavior. When enabled, clipping is deactivated, and any fragments that an object would render that are outside of the [-1, 1] range in NDC space are clamped to this range.