WebGLRenderingContext.getAttribLocation()

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.

WebGLRenderingContext.getAttribLocation() 方法返回了给定WebGLProgram对象中某属性的下标指向位置。

语法

GLint gl.getAttribLocation(program, name);

参数

program

一个包含了属性参数的WebGLProgram 对象。

name

需要获取下标指向位置的 DOMString 属性参数名

返回值

表明属性位置的下标 GLint 数字,如果找不到该属性则返回 -1。

示例

js
gl.getAttribLocation(program, "vColor");

规范

Specification
WebGL Specification
# 5.14.10

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getAttribLocation

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

相关资料