The WebGLRenderingContext.getVertexAttrib()
method of the WebGL API returns information about a vertex attribute at a given position.
any gl.getVertexAttrib(index, pname);
index
GLuint
specifying the index of the vertex attribute.pname
GLenum
specifying the information to query. Possible values: gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
: Returns the currently bound WebGLBuffer
.gl.VERTEX_ATTRIB_ARRAY_ENABLED
: Returns a GLboolean
that is true
if the vertex attribute is enabled at this index
. Otherwise false
.gl.VERTEX_ATTRIB_ARRAY_SIZE
: Returns a GLint
indicating the size of an element of the vertex array.gl.VERTEX_ATTRIB_ARRAY_STRIDE
: Returns a GLint
indicating the number of bytes between successive elements in the array. 0 means that the elements are sequential.gl.VERTEX_ATTRIB_ARRAY_TYPE
: Returns a GLenum
representing the array type. One of gl.BYTE
,gl.UNSIGNED_BYTE
,gl.SHORT
,gl.UNSIGNED_SHORT
,gl.FIXED
,gl.FLOAT
.gl.VERTEX_ATTRIB_ARRAY_NORMALIZED
: Returns a GLboolean
that is true if fixed-point data types are normalized for the vertex attribute array at the given index
.gl.CURRENT_VERTEX_ATTRIB
: Returns a Float32Array
(with 4 elements) representing the current value of the vertex attribute at the given index
.ANGLE_instanced_arrays
extension: ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE
: Returns a GLint
describing the frequency divisor used for instanced rendering.Returns the requested vertex attribute information (as specified with pname
).
gl.getVertexAttrib(0, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING);
Specification | Status | Comment |
---|---|---|
WebGL 1.0 The definition of 'getVertexAttrib' in that specification. | Recommendation | Initial definition for WebGL. |
OpenGL ES 2.0 The definition of 'glGetVertexAttrib' in that specification. | Standard | Man page of the OpenGL ES 2 API. |
WebGL 2.0 The definition of 'getVertexAttrib' in that specification. | Editor's Draft | Updated definition for WebGL 2. |
OpenGL ES 3.0 The definition of 'glGetVertexAttrib' in that specification. | Standard | Man page of the OpenGL ES 3 API. |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Servo |
---|---|---|---|---|---|---|---|
Basic Support | 9 | 12 | 4.0 | 11 | 12 | 5.1 | No support |
WebGL2 | 56 | No support | 51.0 | No support | 43 | No support | No support |
Feature | Android | Chrome for Android | Edge Mobile | Firefox for Android | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | 25 | (Yes) | 4.0 | 11 | 12 | 8.1 |
WebGL2 | No support | No support | (Yes) | 51.0 | No support | No support | No support |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getVertexAttrib