Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/gluten/src/webgl/renderingContext.ts>WebGLContextAttributes

OpenGL bindings & WebGL API implementation for Deno.
Latest
interface WebGLContextAttributes
import { type WebGLContextAttributes } from "https://deno.land/x/gluten@0.1.9/src/webgl/renderingContext.ts";

Properties

optional
alpha: boolean

If the value is true, the drawing buffer has an alpha channel for the purposes of performing OpenGL destination alpha operations and compositing with the page. If the value is false, no alpha buffer is available.

optional
depth: boolean

If the value is true, the drawing buffer has a depth buffer of at least 16 bits. If the value is false, no depth buffer is available.

optional
stencil: boolean

If the value is true, the drawing buffer has a stencil buffer of at least 8 bits. If the value is false, no stencil buffer is available.

optional
antialias: boolean

If the value is true and the implementation supports antialiasing the drawing buffer will perform antialiasing using its choice of technique (multisample/supersample) and quality. If the value is false or the implementation does not support antialiasing, no antialiasing is performed.

optional
premultipliedAlpha: boolean

If the value is true the page compositor will assume the drawing buffer contains colors with premultiplied alpha. If the value is false the page compositor will assume that colors in the drawing buffer are not premultiplied. This flag is ignored if the alpha flag is false.

optional
preserveDrawingBuffer: boolean

If false, once the drawing buffer is presented the contents of the drawing buffer are cleared to their default values. All elements of the drawing buffer (color, depth and stencil) are cleared. If the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author.

optional
powerPreference: WebGLPowerPreference

Provides a hint to the user agent indicating what configuration of GPU is suitable for this WebGL context. This may influence which GPU is used in a system with multiple GPUs. For example, a dual-GPU system might have one GPU that consumes less power at the expense of rendering performance. Note that this property is only a hint and a WebGL implementation may choose to ignore it. WebGL implementations use context lost and restored events to regulate power and memory consumption, regardless of the value of this attribute.

optional
failIfMajorPerformanceCaveat: boolean

If the value is true, context creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.

optional
desynchronized: boolean

If the value is true, then the user agent may optimize the rendering of the canvas to reduce the latency, as measured from input events to rasterization, by desynchronizing the canvas paint cycle from the event loop, bypassing the ordinary user agent rendering algorithm, or both. Insofar as this mode involves bypassing the usual paint mechanisms, rasterization, or both, it might introduce visible tearing artifacts.