GLAPI/glVertexAttribFormat: Difference between revisions
Bot: Adding better formatting. |
m Bot: Adding better formatting. |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 20: | Line 20: | ||
: The type of the data stored in the array. | : The type of the data stored in the array. | ||
; normalized | ; normalized | ||
: | : {{code|GL_TRUE}} if the parameter represents a normalized integer ({{param|type}} must be an integer type). {{code|GL_FALSE}} otherwise. | ||
; relativeoffset | ; relativeoffset | ||
: The | : The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from. | ||
== Description == | == Description == | ||
Line 28: | Line 28: | ||
'''glVertexAttribFormat''', '''glVertexAttribIFormat''' and '''glVertexAttribLFormat''' specify the organization of data in vertex arrays. {{param|attribindex}} specifies the index of the generic vertex attribute array whose data layout is being described, and must be less than the value of {{enum|GL_MAX_VERTEX_ATTRIBS}}. | '''glVertexAttribFormat''', '''glVertexAttribIFormat''' and '''glVertexAttribLFormat''' specify the organization of data in vertex arrays. {{param|attribindex}} specifies the index of the generic vertex attribute array whose data layout is being described, and must be less than the value of {{enum|GL_MAX_VERTEX_ATTRIBS}}. | ||
{{param|size}} determines the number of components per vertex are allocated to the specifed attribute and must be 1, 2, 3 or 4. {{param|type}} indicates the type of the data. If {{param|type}} is one of {{enum|GL_BYTE}}, {{enum|GL_SHORT}}, {{enum|GL_INT}}, {{enum|GL_FIXED}}, {{enum|GL_FLOAT}}, {{enum|GL_HALF_FLOAT}}, and {{enum|GL_DOUBLE}} indicate types {{code|GLbyte}}, {{code|GLshort}}, {{code|GLint}}, {{code|GLfixed}}, {{code|GLfloat}}, {{code|GLhalf}}, and {{code|GLdouble}}, respectively; the values {{enum|GL_UNSIGNED_BYTE}}, {{enum|GL_UNSIGNED_SHORT}}, and {{enum|GL_UNSIGNED_INT}} indicate types {{code|GLubyte}}, {{code|GLushort}}, and {{code|GLuint}}, respectively; | {{param|size}} determines the number of components per vertex are allocated to the specifed attribute and must be 1, 2, 3 or 4. {{param|type}} indicates the type of the data. If {{param|type}} is one of {{enum|GL_BYTE}}, {{enum|GL_SHORT}}, {{enum|GL_INT}}, {{enum|GL_FIXED}}, {{enum|GL_FLOAT}}, {{enum|GL_HALF_FLOAT}}, and {{enum|GL_DOUBLE}} indicate types {{code|GLbyte}}, {{code|GLshort}}, {{code|GLint}}, {{code|GLfixed}}, {{code|GLfloat}}, {{code|GLhalf}}, and {{code|GLdouble}}, respectively; the values {{enum|GL_UNSIGNED_BYTE}}, {{enum|GL_UNSIGNED_SHORT}}, and {{enum|GL_UNSIGNED_INT}} indicate types {{code|GLubyte}}, {{code|GLushort}}, and {{code|GLuint}}, respectively; the values {{enum|GL_INT_2_10_10_10_REV}} and {{enum|GL_UNSIGNED_INT_2_10_10_10_REV}} indicating respectively four signed or unsigned elements packed into a single {{code|GLuint}}; and the value {{enum|GL_UNSIGNED_INT_10F_11F_11F_REV}} indicating three floating point values packed into a single {{code|GLuint}}. | ||
'''glVertexAttribLFormat''' is used to specify layout for data associated with a generic attribute variable declared as 64-bit double precision components. For '''glVertexAttribLFormat''', {{param|type}} must be {{enum|GL_DOUBLE}}. In contrast to '''glVertexAttribFormat''', which will cause data declared as {{enum|GL_DOUBLE}} to be converted to 32-bit representation, '''glVertexAttribLFormat''' causes such data to be left in its natural, 64-bit representation. | '''glVertexAttribLFormat''' is used to specify layout for data associated with a generic attribute variable declared as 64-bit double precision components. For '''glVertexAttribLFormat''', {{param|type}} must be {{enum|GL_DOUBLE}}. In contrast to '''glVertexAttribFormat''', which will cause data declared as {{enum|GL_DOUBLE}} to be converted to 32-bit representation, '''glVertexAttribLFormat''' causes such data to be left in its natural, 64-bit representation. | ||
Line 37: | Line 37: | ||
'''glVertexAttribFormat''' should be used to describe vertex attribute layout for floating-point vertex attributes, '''glVertexAttribIFormat''' should be used to describe vertex attribute layout for integer vertex attribute and '''glVertexAttribLFormat''' should be used to describe the layout for 64-bit vertex attributes. Data for an array specified by '''glVertexAttribIFormat''' will always be left as integer values; such data are referred to as pure integers. | '''glVertexAttribFormat''' should be used to describe vertex attribute layout for floating-point vertex attributes, '''glVertexAttribIFormat''' should be used to describe vertex attribute layout for integer vertex attribute and '''glVertexAttribLFormat''' should be used to describe the layout for 64-bit vertex attributes. Data for an array specified by '''glVertexAttribIFormat''' will always be left as integer values; such data are referred to as pure integers. | ||
== Notes == | |||
{{enum|GL_UNSIGNED_INT_10F_11F_11F_REV}} is accepted for {{param|type}} only if the GL version is 4.4 or higher. | |||
== Errors == | == Errors == | ||
Line 58: | Line 62: | ||
== See Also == | == See Also == | ||
{{apifunc| | {{apifunc|glBindVertexArray}}, {{apifunc|glEnableVertexAttribArray}}, {{apifunc|glVertexAttribBinding}}, {{apifunc|glVertexAttribPointer}}, {{apifunc|glVertexBindingDivisor}} | ||
== Copyright == | == Copyright == | ||
Line 66: | Line 70: | ||
[[Category:Core API Reference|VertexAttribFormat]] | [[Category:Core API Reference|VertexAttribFormat]] | ||
[[Category:Core API Ref Vertex Arrays|VertexAttribFormat]] | [[Category:Core API Ref Vertex Arrays|VertexAttribFormat]] | ||
[[Category:Vertex Array Object API State Functions|VertexAttribFormat]] |
Latest revision as of 10:06, 15 August 2013
Core in version | 4.6 | |
---|---|---|
Core since version | 4.3 | |
Core ARB extension | ARB_vertex_attrib_binding |
glVertexAttribFormat: specify the organization of vertex arrays
Function Definition
void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
- attribindex
- The generic vertex attribute array being described.
- size
- The number of values per vertex that are stored in the array.
- type
- The type of the data stored in the array.
- normalized
- GL_TRUE if the parameter represents a normalized integer (type must be an integer type). GL_FALSE otherwise.
- relativeoffset
- The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from.
Description
glVertexAttribFormat, glVertexAttribIFormat and glVertexAttribLFormat specify the organization of data in vertex arrays. attribindex specifies the index of the generic vertex attribute array whose data layout is being described, and must be less than the value of GL_MAX_VERTEX_ATTRIBS.
size determines the number of components per vertex are allocated to the specifed attribute and must be 1, 2, 3 or 4. type indicates the type of the data. If type is one of GL_BYTE, GL_SHORT, GL_INT, GL_FIXED, GL_FLOAT, GL_HALF_FLOAT, and GL_DOUBLE indicate types GLbyte, GLshort, GLint, GLfixed, GLfloat, GLhalf, and GLdouble, respectively; the values GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, and GL_UNSIGNED_INT indicate types GLubyte, GLushort, and GLuint, respectively; the values GL_INT_2_10_10_10_REV and GL_UNSIGNED_INT_2_10_10_10_REV indicating respectively four signed or unsigned elements packed into a single GLuint; and the value GL_UNSIGNED_INT_10F_11F_11F_REV indicating three floating point values packed into a single GLuint.
glVertexAttribLFormat is used to specify layout for data associated with a generic attribute variable declared as 64-bit double precision components. For glVertexAttribLFormat, type must be GL_DOUBLE. In contrast to glVertexAttribFormat, which will cause data declared as GL_DOUBLE to be converted to 32-bit representation, glVertexAttribLFormat causes such data to be left in its natural, 64-bit representation.
For glVertexAttribFormat, if normalized is GL_TRUE, then integer data is normalized to the range [-1, 1] or [0, 1] if it is signed or unsigned, respectively. If noramlized is GL_FALSE then integer data is directly converted to floating point.
relativeoffset is the offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from.
glVertexAttribFormat should be used to describe vertex attribute layout for floating-point vertex attributes, glVertexAttribIFormat should be used to describe vertex attribute layout for integer vertex attribute and glVertexAttribLFormat should be used to describe the layout for 64-bit vertex attributes. Data for an array specified by glVertexAttribIFormat will always be left as integer values; such data are referred to as pure integers.
Notes
GL_UNSIGNED_INT_10F_11F_11F_REV is accepted for type only if the GL version is 4.4 or higher.
Errors
GL_INVAILD_VALUE is generated if attribindex is greater than or equal to the value of GL_MAX_VERTEX_ATTRIBS.
GL_INVALID_VALUE is generated if size is not one of the accepted values.
GL_INVALID_VALUE is generated if relativeoffset is greater than the value of GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.
GL_INVALID_ENUM is generated if type is not one of the accepted tokens.
GL_INVALID_OPERATION is generated if no vertex array object is bound.
Associated Gets
glGet with arguments GL_MAX_VERTEX_ATTRIB_BINDINGS, or GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.
glGetVertexAttrib with argument GL_VERTEX_ATTRIB_RELATIVE_OFFSET.
See Also
glBindVertexArray, glEnableVertexAttribArray, glVertexAttribBinding, glVertexAttribPointer, glVertexBindingDivisor
Copyright
Copyright © 2012 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/.