GLUniform class
#include <nCine/Graphics/GL/GLUniform.h>
Stores information about an active shader uniform.
Holds the metadata queried for a single active uniform of a linked shader program, such as its location, array size, GL type, name and (when the uniform lives inside a uniform block) its owning block index and byte offset. It carries no value storage of its own and is mainly used to initialize a GLUniformCache.
Public static variables
-
static std::
uint32_t MaxNameLength constexpr - Maximum length of a uniform name, including the terminating null character.
Constructors, destructors, conversion operators
Public functions
- auto GetIndex() const -> GLuint
- Returns the active uniform index within the program.
- auto GetBlockIndex() const -> GLint
- Returns the index of the owning uniform block, or -1 if the uniform is not in a block.
- auto GetLocation() const -> GLint
- Returns the uniform location, or -1 if it has no location (e.g. block members).
- auto GetSize() const -> GLint
- Returns the number of array elements (1 for non-array uniforms).
- auto GetType() const -> GLenum
- Returns the GL type enum of the uniform (e.g.
GL_FLOAT_VEC4). - auto GetOffset() const -> GLint
- Returns the byte offset of the uniform within its uniform block.
- auto GetName() const -> const char*
- Returns the uniform name.
- auto GetBasicType() const -> GLenum
- Returns the basic component type (
GL_FLOAT,GL_INTorGL_BOOL) derived from the GL type. -
auto GetComponentCount() const -> std::
uint32_t - Returns the number of components of the uniform type (e.g. 4 for a
vec4, 16 for amat4). -
auto GetMemorySize() const -> std::
uint32_t - Returns the size in bytes occupied by the uniform value.
- auto HasReservedPrefix() const -> bool
- Returns
trueif the uniform name starts with the reservedgl_prefix.