nCine::GLAttribute class

Stores information about an active vertex shader attribute.

Queried from a linked shader program with glGetActiveAttrib(), this holds the attribute's location, size, GL type and name. Attributes with a reserved gl_ prefix are skipped and keep a location of -1.

Constructors, destructors, conversion operators

GLAttribute()
GLAttribute(GLuint program, GLuint index)

Public functions

auto GetLocation() const -> GLint
Returns the attribute location, or -1 if it has no location.
auto GetSize() const -> GLint
Returns the number of components for array attributes (1 for non-array attributes).
auto GetType() const -> GLenum
Returns the GL type of the attribute (e.g. GL_FLOAT_VEC4).
auto GetName() const -> const char*
Returns the attribute name.
auto GetBasicType() const -> GLenum
Returns the basic GL type underlying the attribute type.
auto GetComponentCount() const -> std::int32_t
Returns the number of components in the attribute type.
auto HasReservedPrefix() const -> bool
Returns true if the attribute name starts with the reserved gl_ prefix.

Function documentation

GLenum nCine::GLAttribute::GetBasicType() const

Returns the basic GL type underlying the attribute type.

Maps a composite type to its scalar component type, e.g. GL_FLOAT_VEC4 to GL_FLOAT.

std::int32_t nCine::GLAttribute::GetComponentCount() const

Returns the number of components in the attribute type.

For example, 4 for GL_FLOAT_VEC4 and 1 for a scalar type.