Back to Content

WebGL2RenderingContext: createQuery() method

files/en-us/web/api/webgl2renderingcontext/createquery/index.md

latest669 B
Original Source

{{APIRef("WebGL")}}{{AvailableInWorkers}}

The WebGL2RenderingContext.createQuery() method of the WebGL 2 API creates and initializes {{domxref("WebGLQuery")}} objects, which provide ways to asynchronously query for information.

Syntax

js-nolint
createQuery()

Parameters

None.

Return value

A {{domxref("WebGLQuery")}} object.

Examples

gl must be a {{domxref("WebGL2RenderingContext")}}. WebGLQuery objects are not available in WebGL 1.

js
const query = gl.createQuery();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("WebGLQuery")}}