简体   繁体   中英

Checking WebGL extension support?

ANGLE_instanced_arrays extension provides hardware instancing for WebGL (woohoo!).

What I'm wondering is whether this is yet supported in Chrome (not Chrome Canary) in version 31?

PS Look as though it's in both Chromium and Canary, but I'm not clear on whether it is in Chrome yet.

To check which extensions are available you have 2 options

1) call gl.getSupportedExtensions() . It returns a list of available extensions

Note: you can do this from the JavaScript/Web Console in the browser. For example in Chrome pick Tools->JavaScript Console then type

document.createElement("canvas").getContext("experimental-webgl").getSupportedExtensions(); 

and you should see a list of extensions.

2) just try to get the extension and check if it succeeds

ext = gl.getExtension("ANGLE_instanced_arrays");
if (ext) {
   // ANGLE_instanced_arrays extension exists
} else {
   // ANGLE_instanced_arrays extension does not exist
}

This is the way your code should work in general. If the extension does not exist either make your code run without it or put up a message you require the extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM