Creates a rendering context.
The rendering context.
Creates a rendering context.
The canvas of the rendering context.
Optional
alpha: booleanWhether the canvas contains an alpha buffer.
Optional
depth: booleanWhether the drawing buffer should have a depth buffer of at least 16 bits.
Optional
stencil: booleanWhether the drawing buffer should have a stencil buffer of at least 8 bits.
Optional
desynchronized: booleanWhether the user agent should reduce latency by desynchronizing the canvas paint cycle from the event loop.
Optional
antialias: booleanWhether or not to perform anti-aliasing if possible.
Optional
failIfMajorPerformanceCaveat: booleanWhether the context will fail to be created if the system performance is low or if no hardware GPU is available.
Optional
powerPreference: PowerPreferenceWhich configuration of GPU is suitable for the context.
Optional
premultipliedAlpha: booleanWhether the page compositor will assume that the drawing buffer contains colors with pre-multiplied alpha.
Optional
preserveDrawingBuffer: booleanWhether the buffers will preserve their values until cleared or overwritten by the author.
Readonly
canvasThe canvas of this rendering context.
Private
extensionsA map of enabled extensions to their names.
Readonly
internalThis rendering context.
The blending functions. Disables blending if not defined.
The blending functions. Disables blending if not defined.
The direction that polygons face to be culled. Disables polygon culling if not defined.
The direction that polygons face to be culled. Disables polygon culling if not defined.
The depth comparison function in use. Disables the depth test if not defined.
The depth comparison function in use. Disables the depth test if not defined.
Whether color components are dithered before they get written to the color buffer.
Whether color components are dithered before they get written to the color buffer.
Whether a temporary coverage value is computed based on the alpha value.
Whether a temporary coverage value is computed based on the alpha value.
The winding orientation of front-facing polygons.
The winding orientation of front-facing polygons.
The scale factor and units used to calculate depth values. Disables polygon offset fill if not defined.
The scale factor and units used to calculate depth values. Disables polygon offset fill if not defined.
Whether fragments should be combined with the temporary coverage value. Disabled if not defined.
Whether fragments should be combined with the temporary coverage value. Disabled if not defined.
The scissor box, which limits drawing to a specified rectangle. Disabled if not defined.
The scissor box, which limits drawing to a specified rectangle. Disabled if not defined.
The stencil test function and reference value. The stencil test is disabled if not defined.
The stencil test function and reference value. The stencil test is disabled if not defined.
The viewport box, which specifies the affine transformation of coordinates from normalized device coordinates to window coordinates.
The viewport box, which specifies the affine transformation of coordinates from normalized device coordinates to window coordinates.
Clears the specified buffers to the specified values.
Optional
color: ColorLikeThe color to clear the color buffer to, if any.
Optional
depth: numberThe value to clear the depth buffer to, if any.
Optional
stencil: numberThe value to clear the stencil buffer to, if any.
Gets the requested extension.
The extension's name.
The extension.
Resizes this context's canvas' drawing buffer to match its physical size, a viewport to match the drawing buffer, and disables the scissor test.
Whether the drawing buffer was resized.
Resizes this context's canvas' drawing buffer to match its physical size, the context's viewport and scissor box to match the given size, and enables the scissor test.
The horizontal offset of the viewport and scissor box.
The vertical offset of the viewport and scissor box.
The horizontal size of the viewport and scissor box.
The vertical size of the viewport and scissor box.
Whether the drawing buffer was resized.
Generated using TypeDoc
A WebGL2 rendering context.