此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

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 ⁨2015年7月⁩.

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

浏览器兼容性

相关资料