GLAPI/glVertexAttribDivisor: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
m See Also: link fixed
m Bot: Adding better formatting.
 
(8 intermediate revisions by 2 users not shown)
Line 9: Line 9:
== Function Definition ==
== Function Definition ==


   void '''glVertexAttribDivisor'''(GLuint ''index'', GLuint ''divisor'');
   void '''glVertexAttribDivisor'''(GLuint {{param|index}}, GLuint {{param|divisor}});


; index
; index
: Specify the index of the generic vertex attribute.
: Specify the index of the generic vertex attribute.
; divisor
; divisor
: Specify the number of instances that will pass between updates of the generic attribute at slot ''index''.
: Specify the number of instances that will pass between updates of the generic attribute at slot {{param|index}}.


== Description ==
== Description ==


'''glVertexAttribDivisor''' modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives in a single draw call. If ''divisor'' is zero, the attribute at slot ''index'' advances once per vertex. If ''divisor'' is non-zero, the attribute advances once per ''divisor'' instances of the set(s) of vertices being rendered. An attribute is referred to as instanced if its {{code|GL_VERTEX_ATTRIB_ARRAY_DIVISOR}} value is non-zero.
'''glVertexAttribDivisor''' modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives in a single draw call. If {{param|divisor}} is zero, the attribute at slot {{param|index}} advances once per vertex. If {{param|divisor}} is non-zero, the attribute advances once per {{param|divisor}} instances of the set(s) of vertices being rendered. An attribute is referred to as instanced if its {{enum|GL_VERTEX_ATTRIB_ARRAY_DIVISOR}} value is non-zero.


''index'' must be less than the value of {{code|GL_MAX_VERTEX_ATTRIBUTES}}.
{{param|index}} must be less than the value of {{enum|GL_MAX_VERTEX_ATTRIBS}}.


== Notes ==
== Notes ==
Line 28: Line 28:
== Errors ==
== Errors ==


{{code|GL_INVALID_VALUE}} is generated if ''index'' is greater than or equal to the value of {{code|GL_MAX_VERTEX_ATTRIBUTES}}.
{{enum|GL_INVALID_VALUE}} is generated if {{param|index}} is greater than or equal to the value of {{enum|GL_MAX_VERTEX_ATTRIBS}}.
 
{{enum|GL_INVALID_OPERATION}} is generated if no vertex array object is bound.


== See Also ==
== See Also ==


[[GLAPI/glVertexAttribPointer|glVertexAttribPointer]], [[GLAPI/glEnableVertexAttribArray|glEnableVertexAttribArray]], [[GLAPI/glEnableVertexAttribArray|glDisableVertexAttribArray]]
{{apifunc|glBindVertexArray}}, {{apifunc|glVertexAttribPointer}}, {{apifunc|glEnableVertexAttribArray}}, {{apifunc|glVertexBindingDivisor}}


== Copyright ==
== Copyright ==
Line 38: Line 40:
Copyright © 2010 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/ http://opencontent.org/openpub/].
Copyright © 2010 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/ http://opencontent.org/openpub/].


[[Category:API Reference 4|VertexAttribDivisor]]
[[Category:Core API Ref Vertex Arrays|VertexAttribDivisor]]
[[Category:Core API Reference|VertexAttribDivisor]]
[[Category:Vertex Array Object API State Functions|VertexAttribDivisor]]

Latest revision as of 10:06, 15 August 2013

glVertexAttribDivisor
Core in version 4.6
Core since version 3.3
ARB extension ARB_instanced_arrays

glVertexAttribDivisor: modify the rate at which generic vertex attributes advance during instanced rendering

Function Definition

 void glVertexAttribDivisor(GLuint index​, GLuint divisor​);
index
Specify the index of the generic vertex attribute.
divisor
Specify the number of instances that will pass between updates of the generic attribute at slot index​.

Description

glVertexAttribDivisor modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives in a single draw call. If divisor​ is zero, the attribute at slot index​ advances once per vertex. If divisor​ is non-zero, the attribute advances once per divisor​ instances of the set(s) of vertices being rendered. An attribute is referred to as instanced if its GL_VERTEX_ATTRIB_ARRAY_DIVISOR value is non-zero.

index​ must be less than the value of GL_MAX_VERTEX_ATTRIBS.

Notes

glVertexAttribDivisor is available only if the GL version is 3.3 or higher.

Errors

GL_INVALID_VALUE is generated if index​ is greater than or equal to the value of GL_MAX_VERTEX_ATTRIBS.

GL_INVALID_OPERATION is generated if no vertex array object is bound.

See Also

glBindVertexArray, glVertexAttribPointer, glEnableVertexAttribArray, glVertexBindingDivisor

Copyright

Copyright © 2010 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/.