WebGLRenderingContext.getAttribLocation()
WebGLRenderingContext.getAttribLocation()
方法返回了给定WebGLProgram
对象中某属性的下标指向位置。
语法
GLint gl.getAttribLocation(program, name);
参数
- program
- 一个包含了属性参数的
WebGLProgram
对象。 - name
- 需要获取下标指向位置的
DOMString
属性参数名
返回值
表明属性位置的下标 GLint
(en-US) 数字,如果找不到该属性则返回-1。
示例
gl.getAttribLocation(program, 'vColor');
规范
规范 | 状态 | 注释 |
---|---|---|
WebGL 1.0 getAttribLocation |
Recommendation | 原始定义. |
OpenGL ES 2.0 glGetAttribLocation |
Standard | OpenGL API的主页. |
浏览器兼容性
BCD tables only load in the browser