GLUniformBlock class
#include <nCine/Graphics/GL/GLUniformBlock.h>
Stores information about an active uniform block.
Holds the metadata queried for a single active uniform block of a linked shader program, such as its index, byte size (padded to the uniform buffer offset alignment), current binding index and the GLUniform members it contains. Member uniforms are discovered only when DiscoverUniforms::ENABLED is requested.
Public types
- enum class DiscoverUniforms { ENABLED, DISABLED }
- Whether the member uniforms of a block should be queried on construction.
Public static variables
-
static std::
uint32_t MaxNameLength constexpr - Maximum length of a uniform block name, including the terminating null character.
Constructors, destructors, conversion operators
- GLUniformBlock()
- Creates an empty, unbound uniform block.
- GLUniformBlock(GLuint program, GLuint blockIndex, DiscoverUniforms discover)
- Queries the active uniform block at the specified index, discovering members as requested.
- GLUniformBlock(GLuint program, GLuint blockIndex)
- Queries the active uniform block at the specified index, discovering its member uniforms.
Public functions
- auto GetIndex() const -> GLuint
- Returns the active uniform block index within the program.
- auto GetBindingIndex() const -> GLint
- Returns the current binding index of the block, or -1 if not bound.
- auto GetSize() const -> GLint
- Returns the block size in bytes, padded to the uniform buffer offset alignment.
-
auto GetAlignAmount() const -> std::
uint8_t - Returns the number of padding bytes added to the original size for offset alignment.
- auto GetName() const -> const char*
- Returns the uniform block name.
- auto GetUniform(const char* name) -> GLUniform*
- Returns the member uniform with the specified name, or
nullptrif not found. - void SetBlockBinding(GLuint blockBinding)
- Sets the binding index of the block, skipping the GL call if it is unchanged.