The WebGLRenderingContext.vertexAttrib[1234]f[v]()
methods of the WebGL API specify values for generic vertex attributes.
void gl.vertexAttrib1f(index, v0); void gl.vertexAttrib2f(index, v0, v1); void gl.vertexAttrib3f(index, v0, v1, v2); void gl.vertexAttrib4f(index, v0, v1, v2, v3); void gl.vertexAttrib1fv(index, value); void gl.vertexAttrib2fv(index, value); void gl.vertexAttrib3fv(index, value); void gl.vertexAttrib4fv(index, value);
index
GLuint
specifying the position of the vertex attribute to be modified.v0, v1, v2, v3
Number
for the vertex attribute value.value
A Float32Array
for floating point vector vertex attribute values.
None.
const a_foobar = gl.getAttribLocation(shaderProgram, 'foobar'); //either set each component individually: gl.vertexAttrib3f(a_foobar, 10.0, 5.0, 2.0); //or provide a Float32Array: const floatArray = new Float32Array([10.0, 5.0, 2.0]); gl.vertexAttrib3fv(a_foobar, floatArray);
Specification | Status | Comment |
---|---|---|
WebGL 1.0 The definition of 'vertexAttrib' in that specification. | Recommendation | Initial definition. |
OpenGL ES 2.0 The definition of 'glVertexAttrib' in that specification. | Standard | Man page of the OpenGL API. |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 9 | 12 | 4 | 11 | 12 | 5.1 |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
© 2005–2018 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/vertexAttrib