web api instance method
WebGLRenderingContext: getVertexAttrib() method
Available in workers
The WebGLRenderingContext.getVertexAttrib() method of the
WebGL API returns information about a vertex
attribute at a given position.
Syntax
getVertexAttrib(index, pname)
Parameters
index- : A
GLuintspecifying the index of the vertex attribute.
- : A
pname-
: A
GLenumspecifying the information to query. Possible values:-
gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING- : Returns the currently bound
WebGLBuffer.
- : Returns the currently bound
-
gl.VERTEX_ATTRIB_ARRAY_ENABLED- : Returns a
GLbooleanthat istrueif the vertex attribute is enabled at thisindex. Otherwisefalse.
- : Returns a
-
gl.VERTEX_ATTRIB_ARRAY_SIZE- : Returns a
GLintindicating the size of an element of the vertex array.
- : Returns a
-
gl.VERTEX_ATTRIB_ARRAY_STRIDE- : Returns a
GLintindicating the number of bytes between successive elements in the array. 0 means that the elements are sequential.
- : Returns a
-
gl.VERTEX_ATTRIB_ARRAY_TYPE- : Returns a
GLenumrepresenting the array type. One ofgl.BYTEgl.UNSIGNED_BYTEgl.SHORT,gl.UNSIGNED_SHORTgl.FLOAT
- : Returns a
-
gl.VERTEX_ATTRIB_ARRAY_NORMALIZED- : Returns a
GLbooleanthat is true if fixed-point data types are normalized for the vertex attribute array at the givenindex.
- : Returns a
-
gl.CURRENT_VERTEX_ATTRIB- : Returns a
Float32Array(with 4 elements) representing the current value of the vertex attribute at the givenindex.
- : Returns a
When using a
WebGL 2 context, the following values are available additionally:gl.VERTEX_ATTRIB_ARRAY_INTEGER- : Returns a
GLbooleanindicating whether an integer data type is in the vertex attribute array at the givenindex.
- : Returns a
gl.VERTEX_ATTRIB_ARRAY_DIVISOR- : Returns a
GLintdescribing the frequency divisor used for instanced rendering.
- : Returns a
When using the
ANGLE_instanced_arraysextension:ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE- : Returns a
GLintdescribing the frequency divisor used for instanced rendering.
- : Returns a
-
-
Return value
Returns the requested vertex attribute information (as specified with
pname).
Examples
gl.getVertexAttrib(0, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING);
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.