WebGLRenderingContext.getAttribLocation()

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

语法

GLint gl.getAttribLocation(program, name);

参数

program
一个包含了属性参数的WebGLProgram 对象。
name
需要获取下标指向位置的 DOMString 属性参数名

返回值

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

示例

gl.getAttribLocation(program, 'vColor');

规范

规范 状态 注释
WebGL 1.0
getAttribLocation
Recommendation 原始定义.
OpenGL ES 2.0
glGetAttribLocation
Standard OpenGL API的主页.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8.1Samsung Internet Android Full support Yes

Legend

Full support  
Full support

相关资料

文档标签和贡献者

此页面的贡献者: kimmyLoveStudy
最后编辑者: kimmyLoveStudy,