Scroll to navigation

GLVERTEXATTRIB(3G) [FIXME: manual] GLVERTEXATTRIB(3G)

NAME

glVertexAttrib - Specifies the value of a generic vertex attribute

C SPECIFICATION

void glVertexAttrib1f(GLuint index, GLfloat v0);

void glVertexAttrib1s(GLuint index, GLshort v0);

void glVertexAttrib1d(GLuint index, GLdouble v0);

void glVertexAttribI1i(GLuint index, GLint v0);

void glVertexAttribI1ui(GLuint index, GLuint v0);

void glVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1);

void glVertexAttrib2s(GLuint index, GLshort v0, GLshort v1);

void glVertexAttrib2d(GLuint index, GLdouble v0, GLdouble v1);

void glVertexAttribI2i(GLuint index, GLint v0, GLint v1);

void glVertexAttribI2ui(GLuint index, GLuint v0, GLuint v1);

void glVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2);

void glVertexAttrib3s(GLuint index, GLshort v0, GLshort v1, GLshort v2);

void glVertexAttrib3d(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2);

void glVertexAttribI3i(GLuint index, GLint v0, GLint v1, GLint v2);

void glVertexAttribI3ui(GLuint index, GLuint v0, GLuint v1, GLuint v2);

void glVertexAttrib4f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);

void glVertexAttrib4s(GLuint index, GLshort v0, GLshort v1, GLshort v2, GLshort v3);

void glVertexAttrib4d(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);

void glVertexAttrib4Nub(GLuint index, GLubyte v0, GLubyte v1, GLubyte v2, GLubyte v3);

void glVertexAttribI4i(GLuint index, GLint v0, GLint v1, GLint v2, GLint v3);

void glVertexAttribI4ui(GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3);

void glVertexAttribL1d(GLuint index, GLdouble v0);

void glVertexAttribL2d(GLuint index, GLdouble v0, GLdouble v1);

void glVertexAttribL3d(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2);

void glVertexAttribL4d(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);

void glVertexAttrib1fv(GLuint index, const GLfloat *v);

void glVertexAttrib1sv(GLuint index, const GLshort *v);

void glVertexAttrib1dv(GLuint index, const GLdouble *v);

void glVertexAttribI1iv(GLuint index, const GLint *v);

void glVertexAttribI1uiv(GLuint index, const GLuint *v);

void glVertexAttrib2fv(GLuint index, const GLfloat *v);

void glVertexAttrib2sv(GLuint index, const GLshort *v);

void glVertexAttrib2dv(GLuint index, const GLdouble *v);

void glVertexAttribI2iv(GLuint index, const GLint *v);

void glVertexAttribI2uiv(GLuint index, const GLuint *v);

void glVertexAttrib3fv(GLuint index, const GLfloat *v);

void glVertexAttrib3sv(GLuint index, const GLshort *v);

void glVertexAttrib3dv(GLuint index, const GLdouble *v);

void glVertexAttribI3iv(GLuint index, const GLint *v);

void glVertexAttribI3uiv(GLuint index, const GLuint *v);

void glVertexAttrib4fv(GLuint index, const GLfloat *v);

void glVertexAttrib4sv(GLuint index, const GLshort *v);

void glVertexAttrib4dv(GLuint index, const GLdouble *v);

void glVertexAttrib4iv(GLuint index, const GLint *v);

void glVertexAttrib4bv(GLuint index, const GLbyte *v);

void glVertexAttrib4ubv(GLuint index, const GLubyte *v);

void glVertexAttrib4usv(GLuint index, const GLushort *v);

void glVertexAttrib4uiv(GLuint index, const GLuint *v);

void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);

void glVertexAttrib4Nsv(GLuint index, const GLshort *v);

void glVertexAttrib4Niv(GLuint index, const GLint *v);

void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);

void glVertexAttrib4Nusv(GLuint index, const GLushort *v);

void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);

void glVertexAttribI4bv(GLuint index, const GLbyte *v);

void glVertexAttribI4ubv(GLuint index, const GLubyte *v);

void glVertexAttribI4sv(GLuint index, const GLshort *v);

void glVertexAttribI4usv(GLuint index, const GLushort *v);

void glVertexAttribI4iv(GLuint index, const GLint *v);

void glVertexAttribI4uiv(GLuint index, const GLuint *v);

void glVertexAttribL1dv(GLuint index, const GLdouble *v);

void glVertexAttribL2dv(GLuint index, const GLdouble *v);

void glVertexAttribL3dv(GLuint index, const GLdouble *v);

void glVertexAttribL4dv(GLuint index, const GLdouble *v);

void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);

void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);

void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);

void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);

PARAMETERS

index

Specifies the index of the generic vertex attribute to be modified.

v0, v1, v2, v3

For the scalar commands, specifies the new values to be used for the specified vertex attribute.

v

For the vector commands (glVertexAttrib*v), specifies a pointer to an array of values to be used for the generic vertex attribute.

type

For the packed commands (glVertexAttribP*), specified the type of packing used on the data. This parameter must be GL_INT_2_10_10_10_REV or GL_UNSIGNED_INT_2_10_10_10_REV, to specify signed or unsigned data, respectively, or GL_UNSIGNED_INT_10F_11F_11F_REV to specify floating point data.

normalized

For the packed commands, if GL_TRUE, then the values are to be converted to floating point values by normalizing. Otherwise, they are converted directly to floating-point values. If type indicates a floating-pont format, then normalized value must be GL_FALSE.

value

For the packed commands, specifies the new packed value to be used for the specified vertex attribute.

DESCRIPTION

The glVertexAttrib family of entry points allows an application to pass generic vertex attributes in numbered locations.

Generic attributes are defined as four-component values that are organized into an array. The first entry of this array is numbered 0, and the size of the array is specified by the implementation-dependent constant GL_MAX_VERTEX_ATTRIBS. Individual elements of this array can be modified with a glVertexAttrib call that specifies the index of the element to be modified and a value for that element.

These commands can be used to specify one, two, three, or all four components of the generic vertex attribute specified by index. A 1 in the name of the command indicates that only one value is passed, and it will be used to modify the first component of the generic vertex attribute. The second and third components will be set to 0, and the fourth component will be set to 1. Similarly, a 2 in the name of the command indicates that values are provided for the first two components, the third component will be set to 0, and the fourth component will be set to 1. A 3 in the name of the command indicates that values are provided for the first three components and the fourth component will be set to 1, whereas a 4 in the name indicates that values are provided for all four components.

The letters s, f, i, d, ub, us, and ui indicate whether the arguments are of type short, float, int, double, unsigned byte, unsigned short, or unsigned int. When v is appended to the name, the commands can take a pointer to an array of such values.

Additional capitalized letters can indicate further alterations to the default behavior of the glVertexAttrib function:

The commands containing N indicate that the arguments will be passed as fixed-point values that are scaled to a normalized range according to the component conversion rules defined by the OpenGL specification. Signed values are understood to represent fixed-point values in the range [-1,1], and unsigned values are understood to represent fixed-point values in the range [0,1].

The commands containing I indicate that the arguments are extended to full signed or unsigned integers.

The commands containing P indicate that the arguments are stored as packed components within a larger natural type.

The commands containing L indicate that the arguments are full 64-bit quantities and should be passed directly to shader inputs declared as 64-bit double precision types.

OpenGL Shading Language attribute variables are allowed to be of type mat2, mat3, or mat4. Attributes of these types may be loaded using the glVertexAttrib entry points. Matrices must be loaded into successive generic attribute slots in column major order, with one column of the matrix in each generic attribute slot.

A user-defined attribute variable declared in a vertex shader can be bound to a generic attribute index by calling glBindAttribLocation(). This allows an application to use more descriptive variable names in a vertex shader. A subsequent change to the specified generic vertex attribute will be immediately reflected as a change to the corresponding attribute variable in the vertex shader.

The binding between a generic vertex attribute index and a user-defined attribute variable in a vertex shader is part of the state of a program object, but the current value of the generic vertex attribute is not. The value of each generic vertex attribute is part of current state, just like standard vertex attributes, and it is maintained even if a different program object is used.

An application may freely modify generic vertex attributes that are not bound to a named vertex shader attribute variable. These values are simply maintained as part of current state and will not be accessed by the vertex shader. If a generic vertex attribute bound to an attribute variable in a vertex shader is not updated while the vertex shader is executing, the vertex shader will repeatedly use the current value for the generic vertex attribute.

NOTES

Generic vertex attributes can be updated at any time.

It is possible for an application to bind more than one attribute name to the same generic vertex attribute index. This is referred to as aliasing, and it is allowed only if just one of the aliased attribute variables is active in the vertex shader, or if no path through the vertex shader consumes more than one of the attributes aliased to the same location. OpenGL implementations are not required to do error checking to detect aliasing, they are allowed to assume that aliasing will not occur, and they are allowed to employ optimizations that work only in the absence of aliasing.

There is no provision for binding standard vertex attributes; therefore, it is not possible to alias generic attributes with standard attributes.

glVertexAttribL versions are available only if the GL version is 4.1 or higher.

GL_UNSIGNED_INT_10F_11F_11F_REV is accepted for type by glVertexAttribP* only if the GL version is 4.4 or higher.

ERRORS

GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.

GL_INVALID_ENUM is generated if glVertexAttribP* is used with a type other than GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV, or GL_UNSIGNED_INT_10F_11F_11F_REV.

GL_INVALID_ENUM is generated if glVertexAttribL is used with a type other than GL_DOUBLE.

ASSOCIATED GETS

glGet() with the argument GL_CURRENT_PROGRAM

glGetActiveAttrib() with argument program and the index of an active attribute variable

glGetAttribLocation() with argument program and an attribute variable name

glGetVertexAttrib() with arguments GL_CURRENT_VERTEX_ATTRIB and index

VERSION SUPPORT

OpenGL Version
Function / Feature Name 2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5
glVertexAttrib1d
glVertexAttrib1dv
glVertexAttrib1f
glVertexAttrib1fv
glVertexAttrib1s
glVertexAttrib1sv
glVertexAttrib2d
glVertexAttrib2dv
glVertexAttrib2f
glVertexAttrib2fv
glVertexAttrib2s
glVertexAttrib2sv
glVertexAttrib3d
glVertexAttrib3dv
glVertexAttrib3f
glVertexAttrib3fv
glVertexAttrib3s
glVertexAttrib3sv
glVertexAttrib4Nbv
glVertexAttrib4Niv
glVertexAttrib4Nsv
glVertexAttrib4Nub
glVertexAttrib4Nubv
glVertexAttrib4Nuiv
glVertexAttrib4Nusv
glVertexAttrib4bv
glVertexAttrib4d
glVertexAttrib4dv
glVertexAttrib4f
glVertexAttrib4fv
glVertexAttrib4iv
glVertexAttrib4s
glVertexAttrib4sv
glVertexAttrib4ubv
glVertexAttrib4uiv
glVertexAttrib4usv
glVertexAttribI1i - -
glVertexAttribI1iv - -
glVertexAttribI1ui - -
glVertexAttribI1uiv - -
glVertexAttribI2i - -
glVertexAttribI2iv - -
glVertexAttribI2ui - -
glVertexAttribI2uiv - -
glVertexAttribI3i - -
glVertexAttribI3iv - -
glVertexAttribI3ui - -
glVertexAttribI3uiv - -
glVertexAttribI4bv - -
glVertexAttribI4i - -
glVertexAttribI4iv - -
glVertexAttribI4sv - -
glVertexAttribI4ubv - -
glVertexAttribI4ui - -
glVertexAttribI4uiv - -
glVertexAttribI4usv - -
glVertexAttribL1d - - - - - - -
glVertexAttribL1dv - - - - - - -
glVertexAttribL2d - - - - - - -
glVertexAttribL2dv - - - - - - -
glVertexAttribL3d - - - - - - -
glVertexAttribL3dv - - - - - - -
glVertexAttribL4d - - - - - - -
glVertexAttribL4dv - - - - - - -
glVertexAttribP1ui - - - -
glVertexAttribP2ui - - - -
glVertexAttribP3ui - - - -
glVertexAttribP4ui - - - -

SEE ALSO

glBindAttribLocation(), glVertexAttribPointer()

COPYRIGHT

Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

COPYRIGHT

Copyright © 2003-2005 3Dlabs Inc. Ltd.
Copyright © 2010-2014 Khronos Group

04/12/2021 [FIXME: source]