ANGLE_instanced_arrays

翻译不完整。 请帮助我们翻译这篇文章!

ANGLE_instanced_arrays属于 WebGL API 的一个扩展API,它允许多次绘制相同的对象或相似对象组,前提是它们共享相同的顶点数据、基本图形的个数和类型。
WebGL的扩展都能使用WebGLRenderingContext.getExtension() 这个方法。更多详细信息,请参考 WebGL tutorial(WebGL使用教程)里的Using Extensions (使用扩展)

实用性: 这个扩展仅仅能使用在 WebGL1 上下文中。在 WebGL2,默认情况下这个扩展的在WebGL2的上下文中起作用,它的常量以及方法使用过程中没有“ANGEL”后缀。

尽管名字叫“ANGLE”,只要硬件支持,它可以运行在任意设备上,而不仅是在Windows上起作用。 "ANGLE"只是表明了这个扩展是被ANGLE这个库的作者书写的,并没有更多的含义。

常量

这个扩展提供了一个新常量,它能被 gl.getVertexAttrib() 这个方法所使用:

ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE
当这个常量在gl.getVertexAttrib()中作为pname参数使用时,将返回一个用于实例渲染的频率因子GLint

方法

这个扩展提供了三个新的方法。

ext.drawArraysInstancedANGLE()

作用与gl.drawArrays() 相同,除了元素范围的多实例的执行以及每次迭代时的实例扩展。

ext.drawElementsInstancedANGLE()

作用与gl.drawElements()相同,除了元素集中的多实例的计算以及每个集之间的实例扩展。

ext.vertexAttribDivisorANGLE()
当用ext.drawArraysInstancedANGLE()ext.drawElementsInstancedANGLE()渲染基本图元的多实例时,会提升通用的顶点属性的速度。

示例

启用扩展:

var ext = gl.getExtension("ANGLE_instanced_arrays");

规范

Specification Status Comment
ANGLE_instanced_arrays
ANGLE_instanced_arrays
Recommendation 初始定义。

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
ANGLE_instanced_arraysChrome Full support 30
Alternate Name
Full support 30
Alternate Name
Alternate Name Uses the non-standard name: ANGLEInstancedArrays
Edge Full support 79
Alternate Name
Full support 79
Alternate Name
Alternate Name Uses the non-standard name: ANGLEInstancedArrays
No support 12 — 79
Firefox Full support 33IE Full support 11Opera Full support 17
Alternate Name
Full support 17
Alternate Name
Alternate Name Uses the non-standard name: ANGLEInstancedArrays
Safari Full support 7WebView Android Full support 4.4
Alternate Name
Full support 4.4
Alternate Name
Alternate Name Uses the non-standard name: ANGLEInstancedArrays
Chrome Android Full support 30
Alternate Name
Full support 30
Alternate Name
Alternate Name Uses the non-standard name: ANGLEInstancedArrays
Firefox Android Full support YesOpera Android Full support 18
Alternate Name
Full support 18
Alternate Name
Alternate Name Uses the non-standard name: ANGLEInstancedArrays
Safari iOS Full support YesSamsung Internet Android Full support 2.0
Alternate Name
Full support 2.0
Alternate Name
Alternate Name Uses the non-standard name: ANGLEInstancedArrays
drawArraysInstancedANGLEChrome Full support 30Edge Full support 12Firefox Full support 33IE Full support 11Opera Full support 17Safari Full support 7WebView Android Full support 4.4Chrome Android Full support 30Firefox Android Full support YesOpera Android Full support 18Safari iOS Full support YesSamsung Internet Android Full support 2.0
drawElementsInstancedANGLEChrome Full support 30Edge Full support 12Firefox Full support 33IE Full support 11Opera Full support 17Safari Full support 7WebView Android Full support 4.4Chrome Android Full support 30Firefox Android Full support YesOpera Android Full support 18Safari iOS Full support YesSamsung Internet Android Full support 2.0
vertexAttribDivisorANGLEChrome Full support 30Edge Full support 12Firefox Full support 33IE Full support 11Opera Full support 17Safari Full support 7WebView Android Full support 4.4Chrome Android Full support 30Firefox Android Full support YesOpera Android Full support 18Safari iOS Full support YesSamsung Internet Android Full support 2.0

Legend

Full support  
Full support
Uses a non-standard name.
Uses a non-standard name.

相关链接