VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members

The definition of a vertex attribute, such as a position vector, or a texture coordinate. More...

Public Member Functions

 Attribute ()
 Constructor creating an empty attribute definition. More...
 
 Attribute (const std::string &name, GLuint size, GLboolean normalized, GLuint type)
 Constructor creating an attribute with the properties. More...
 
int getComponentSize () const
 Computes the number of bytes per component. More...
 

Static Public Member Functions

static int getComponentSizeStatic (GLuint type)
 Computes the number of bytes per component for a given GL type. More...
 

Public Attributes

std::string name
 Name of the attribute, as specified in the shader code. More...
 
GLuint size = 0
 Number of components per vertex attribute. More...
 
GLboolean normalized = GL_FALSE
 Specifies whether certain types should be normalized before accessed by shaders. More...
 
GLuint type = GL_FLOAT
 GL type of each component in the array. More...
 

Detailed Description

The definition of a vertex attribute, such as a position vector, or a texture coordinate.

Vertex attributes are defined by their name, and the type of data they contain. For example, 2D texture coordinates are float vectors of width two. Attributes are associated with shaders and meshes. They determine how the data in a mesh should be read by the shader.

Constructor & Destructor Documentation

Attribute::Attribute ( )

Constructor creating an empty attribute definition.

Attribute::Attribute ( const std::string &  name,
GLuint  size,
GLboolean  normalized,
GLuint  type 
)

Constructor creating an attribute with the properties.

Parameters
nameName of the attribute
sizeNumber of components per vertex attribute
normalizedSpecifies whether certain types should be normalized before accessed
typeGL type of each component in the array

Member Function Documentation

int Attribute::getComponentSize ( ) const
inline

Computes the number of bytes per component.

Returns
Number of bytes per component
static int Attribute::getComponentSizeStatic ( GLuint  type)
static

Computes the number of bytes per component for a given GL type.

Parameters
typeGL type to get the size of
Returns
Number of bytes per component

Member Data Documentation

std::string Attribute::name

Name of the attribute, as specified in the shader code.

GLboolean Attribute::normalized = GL_FALSE

Specifies whether certain types should be normalized before accessed by shaders.

GLuint Attribute::size = 0

Number of components per vertex attribute.

GLuint Attribute::type = GL_FLOAT

GL type of each component in the array.