Class attribute

Inheritance Relationships

Base Type

Class Documentation

class legion::rendering::attribute : public legion::rendering::shader_parameter_base

Shader parameter that represents an attribute.

Public Functions

inline attribute(id_type shaderId, std::string_view name, GLenum type, GLint location)
inline void set_attribute_pointer(GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLsizei pointer)

Attach the currently bound array buffer to this attribute.

  • size: Number of components in the data tensor (1: r, 2: rg, 3: rgb, 4: rgba).

  • type: Data type of the components in the tensor.

  • normalized: Normalize the tensors before sending to VRAM.

  • stride: Amount of bytes in-between valid data chunks.

  • pointer: Amount of bytes until the first valid data chunk.

inline void disable_attribute_pointer()

Disable the attribute after you’re done with it. Leaving it enabled can cause performance issues due to limiting the GPU to move and reallocate it’s VRAM.

inline void set_divisor(uint offset, uint divisor)

Set an interval between the iteration increments of the array.

  • offset: Offset for the targeting location (0: vector or matrix row0, 1: matrix row1, 2: matrix row2… etc.).

  • divisor: Amount of instances between each iteration increment. 0 means the iteration will increment for each vertex.