WebGLRenderingContext.getAttribLocation()

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

语法

GLint gl.getAttribLocation(program, name);

参数

program

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

name

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

返回值

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

示例

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

规范

Specification
WebGL Specification
# 5.14.10

浏览器兼容性

BCD tables only load in the browser

相关资料