Graphics Reference
In-Depth Information
Note that
glGenRenderbuffers
is not required to assign a renderbuffer
object name before it is bound using
glBindRenderbuffer
. Although
it is a good practice to call
glGenRenderbuffers
, many applications
specify compile-time constants for their buffers. An application can
specify an unused renderbuffer object name to
glBindRenderbuffer
.
However, we do recommend that OpenGL ES applications call
glGenRenderbuffers
and use renderbuffer object names returned
by
glGenRenderbuffers
instead of specifying their own buffer
object names.
The first time the renderbuffer object name is bound by calling
glBindRenderbuffer
, the renderbuffer object is allocated with the
appropriate default state. If this allocation is successful, the allocated
object will become the newly bound renderbuffer object.
The following state and default values are associated with a renderbuffer
object:
• Width and height in pixels—The default value is zero.
• Internal format—This describes the format of the pixels stored in the
renderbuffer. It must be a color-, depth-, or stencil-renderable format.
• Color bit-depth—This is valid only if the internal format is a color-
renderable format. The default value is zero.
• Depth bit-depth—This is valid only if the internal format is a depth-
renderable format. The default value is zero.
• Stencil bit-depth—This is valid only if the internal format is a stencil-
renderable format. The default value is zero.
glBindRenderbuffer
can also be used to bind to an existing renderbuffer
object (i.e., an object that has been assigned and used before and,
therefore, has a valid state associated with it). No changes to the state of
the newly bound renderbuffer object are made by the bind command.
Once a renderbuffer object is bound, we can specify the
dimensions and format of the image stored in the renderbuffer. The
glRenderbufferStorage
command can be used for this purpose.
glRenderbufferStorage
looks very similar to
glTexImage2D
, except
that no image data is supplied. You can also create a multisample
renderbuffer by using the
glRenderbufferStorageMultisample
command.
glRenderbufferStorage
is equivalent to
glRenderStorageMultisample
with samples set to zero. The width
and height of the renderbuffer are specified in pixels and must