MDN self-hosted library · e01.org

WebGL2RenderingContext: vertexAttribDivisor() method

WebGL

WebGL

The WebGL2RenderingContext.vertexAttribDivisor() method of the WebGL 2 API modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with gl.drawArraysInstanced() and gl.drawElementsInstanced().

[!NOTE] When using WebGL 1, the ANGLE_instanced_arrays extension can provide this method, too.

Syntax

vertexAttribDivisor(index, divisor)

Parameters

  • index
  • : A GLuint specifying the index of the generic vertex attributes.
  • divisor
  • : A GLuint specifying the number of instances that will pass between updates of the generic attribute.

Return value

None (undefined).

Examples

gl.vertexAttribDivisor(0, 2);

Specifications

Browser compatibility

See also

  • ANGLE_instanced_arrays.vertexAttribDivisorANGLE()