Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. WebGLRenderingContext
  4. getVertexAttrib()

WebGLRenderingContext: getVertexAttrib() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Note: This feature is available inWeb Workers.

TheWebGLRenderingContext.getVertexAttrib() method of theWebGL API returns information about a vertexattribute at a given position.

Syntax

js
getVertexAttrib(index, pname)

Parameters

index

AGLuint specifying the index of the vertex attribute.

pname

AGLenum specifying the information to query. Possible values:

gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING

Returns the currently boundWebGLBuffer.

gl.VERTEX_ATTRIB_ARRAY_ENABLED

Returns aGLboolean that istrue if the vertex attribute is enabled at thisindex. Otherwisefalse.

gl.VERTEX_ATTRIB_ARRAY_SIZE

Returns aGLintindicating the size of an element of the vertex array.

gl.VERTEX_ATTRIB_ARRAY_STRIDE

Returns aGLintindicating the number of bytes between successive elements in the array. 0 meansthat the elements are sequential.

gl.VERTEX_ATTRIB_ARRAY_TYPE

Returns aGLenumrepresenting the array type. One of

  • gl.BYTE
  • gl.UNSIGNED_BYTE
  • gl.SHORT,
  • gl.UNSIGNED_SHORT
  • gl.FLOAT
gl.VERTEX_ATTRIB_ARRAY_NORMALIZED

Returns aGLboolean that is true if fixed-point data types are normalized forthe vertex attribute array at the givenindex.

gl.CURRENT_VERTEX_ATTRIB

Returns aFloat32Array(with 4 elements) representing the current value of the vertex attribute at thegivenindex.

When using aWebGL 2 context,the following values are available additionally:

gl.VERTEX_ATTRIB_ARRAY_INTEGER

Returns aGLboolean indicating whether an integer data type is inthe vertex attribute array at the givenindex.

gl.VERTEX_ATTRIB_ARRAY_DIVISOR

Returns aGLintdescribing the frequency divisor used for instanced rendering.

When using theANGLE_instanced_arrays extension:

ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE

Returns aGLint describing the frequency divisor used for instancedrendering.

Return value

Returns the requested vertex attribute information (as specified withpname).

Examples

js
gl.getVertexAttrib(0, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING);

Specifications

Specification
WebGL Specification
# 5.14.10
WebGL 2.0 Specification
# 3.7.8

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp