WebGLQuery
The WebGLQuery interface is part of the WebGL 2 API and provides ways to asynchronously query for information. By default, occlusion queries and primitive queries are available.
Another kind of queries are disjoint timer queries, which allow you to measure performance and profiling of your GPU. Disjoint timer queries are available with the EXT_disjoint_timer_query extension only.
When working with WebGLQuery objects, the following methods of the WebGL2RenderingContext are useful:
WebGL2RenderingContext.createQuery()WebGL2RenderingContext.deleteQuery()WebGL2RenderingContext.isQuery()WebGL2RenderingContext.beginQuery()WebGL2RenderingContext.endQuery()WebGL2RenderingContext.getQuery()WebGL2RenderingContext.getQueryParameter()
Examples
Creating a WebGLQuery object
in this example, gl must be a WebGL2RenderingContext. WebGLQuery objects are not available in WebGL 1.
var query = gl.createQuery();
Specifications
| Specification |
|---|
| WebGL 2.0 Specification (WebGL 2.0) # 3.2 |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
WebGLQuery |
56 |
79 |
51 |
No |
43 |
No |
58 |
58 |
51 |
43 |
No |
7.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebGLQuery