Graphics Reference
In-Depth Information
void
glUniformBlockBinding
(GLuint
program
,
GLuint
blockIndex
,
GLuint
blockBinding
)
program
handle to the program object
blockIndex
index of the uniform block
blockBinding
uniform buffer object binding point
Finally, you can bind the uniform buffer object to the
GL_UNIFORM_
BUFFER
target and a uniform block binding point in the program using
glBindBufferRange
or
glBindBufferBase
.
void
glBindBufferRange
(GLenum
target,
GLuint
index,
GLuint
buffer,
GLintptr
offset,
GLsizeiptr
size
)
void
glBindBufferBase
(GLenum
target,
GLuint
index,
GLuint
buffer)
must be
GL_UNIFORM_BUFFER
or
GL_TRANSFORM_FEEDBACK_BUFFER
target
the binding index
index
the handle to the buffer object
buffer
a starting offset in bytes into the buffer object
(
glBindBufferRange
only)
offset
the amount of data in bytes that can be read from or written
to the buffer object (
glBindBufferRange
only)
size
When programming the uniform blocks, you should pay attention to the
following limitations:
• The maximum number of active uniform blocks used by a vertex
or fragment shader can be queried using
glGetIntegerv
with
GL_MAX_VERTEX_UNIFORM_BLOCKS
or
GL_MAX_FRAGMENT_UNIFORM_
BLOCKS
, respectively. The minimum supported number for any
implementation is 12.
• The maximum number of combined active uniform blocks used by
all shaders in a program can be queried using
glGetIntegerv
with
GL_MAX_COMBINED_UNIFORM_BLOCKS
. The minimum supported
number for any implementation is 24.