Magnum::GL::DynamicAttribute class

Base class for dynamic vertex attribute location and type.

Counterpart to Attribute that allows runtime specification of attribute location and base type. Note that unlike the compile-time specification, this class doesn't do any sanity verification and leaves most of the responsibility on the user.

Public types

enum class Kind { Generic, GenericNormalized, Integral, Long }
Attribute kind.
enum class Components: GLint { One = 1, Two = 2, Three = 3, Four = 4, BGRA = GL_BGRA }
Component count.
enum class DataType: GLenum { UnsignedByte = GL_UNSIGNED_BYTE, Byte = GL_BYTE, UnsignedShort = GL_UNSIGNED_SHORT, Short = GL_SHORT, UnsignedInt = GL_UNSIGNED_INT, Int = GL_INT, HalfFloat = GL_HALF_FLOAT, Float = GL_FLOAT, Double = GL_DOUBLE, UnsignedInt10f11f11fRev = GL_UNSIGNED_INT_10F_11F_11F_REV, UnsignedInt2101010Rev = GL_UNSIGNED_INT_2_10_10_10_REV, Int2101010Rev = GL_INT_2_10_10_10_REV }
Data type.

Constructors, destructors, conversion operators

DynamicAttribute(Kind kind, UnsignedInt location, Components components, DataType dataType) constexpr
Constructor.
template<UnsignedInt location_, class T>
DynamicAttribute(const Attribute<location_, T>& attribute) constexpr new in 2019.10
Construct from a compile-time attribute.

Public functions

auto kind() const -> Kind constexpr
Attribute kind.
auto location() const -> UnsignedInt constexpr
Attribute location.
auto components() const -> Components constexpr
Component count.
auto dataType() const -> DataType constexpr
Type of passed data.

Enum documentation

enum class Magnum::GL::DynamicAttribute::Kind

Attribute kind.

Specifies what kind of shader type matches the attribute.

Enumerators
Generic

Generic, matches single-precision floating-point shader type

GenericNormalized

Normalized integral, matches single-precision floating-point shader type

Integral

Integral, matches integral shader type

Long

Long, matches double-precision shader type

enum class Magnum::GL::DynamicAttribute::Components: GLint

Component count.

Count of components passed to the shader. If passing smaller count of components than corresponding type has, unspecified components are set to default values (second and third to 0, fourth to 1).

Enumerators
One

Only first component is specified. Second, third and fourth component are set to 0, 0, 1, respectively. Only for scalar and vector types, not matrices.

Two

First two components are specified. Third and fourth component are set to 0, 1, respectively. Only for two, three and four-component vector types and 2x2, 3x2 and 4x2 matrix types.

Three

First three components are specified. Fourth component is set to 1. Only for three and four-component vector types, 2x3, 3x3 and 4x3 matrix types.

Four

All four components are specified. Only for four-component vector types and 2x4, 3x4 and 4x4 matrix types.

BGRA

Four components with BGRA ordering. Only for four-component float vector type. Must be used along with DataType::UnsignedByte and Kind::GenericNormalized.

enum class Magnum::GL::DynamicAttribute::DataType: GLenum

Data type.

Type of data passed to shader.

Enumerators
UnsignedByte

Unsigned byte

Byte

Byte

UnsignedShort

Unsigned short

Short

Short

UnsignedInt

Unsigned int

Int

Int

HalfFloat

Half float. Only for float attribute types.

Float

Float. Only for float attribute types.

Double

Double. Only for float and double attribute types.

UnsignedInt10f11f11fRev

Unsigned 10.11.11 packed float. Only for three-component float vector attribute type.

UnsignedInt2101010Rev

Unsigned 2.10.10.10 packed integer. Only for four-component float vector attribute type.

Int2101010Rev

Signed 2.10.10.10 packed integer. Only for four-component float vector attribute type.

Function documentation

Magnum::GL::DynamicAttribute::DynamicAttribute(Kind kind, UnsignedInt location, Components components, DataType dataType) constexpr

Constructor.

Parameters
kind Attribute kind
location Attribute location
components Component count
dataType Type of passed data

Debug& operator<<(Debug& debug, DynamicAttribute::Kind)

Debug output operator.