Creates a new WebGLContextWrapper instance.
The configuration for the WebGL context
The WebGL2 rendering context to wrap
The HTML canvas element associated with the context
Cached results of getExtension / vendor-prefixed getExtension. Values are WebGL extension API objects (distinct from WebGLResource: buffers, textures, programs, etc.).
ReadonlycanvasOptional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl1Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Optional Readonlywebgl2Gets the default viewport settings.
A Vector4 containing default viewport left, top, width, and height
Checks if the current context is WebGL2.
True if WebGL2, false if WebGL1
Gets the current viewport settings.
A Vector4 containing viewport left, top, width, and height
Binds a 2D texture to a specific texture unit. Optimized to avoid redundant state changes.
The texture unit index
The 2D texture to bind
Binds a 2D array texture to a specific texture unit. Optimized to avoid redundant state changes.
The texture unit index
The 2D array texture to bind
Binds a cube map texture to a specific texture unit. Optimized to avoid redundant state changes.
The texture unit index
The cube map texture to bind
Binds a sampler object to a specific texture unit. Optimized to avoid redundant state changes.
The texture unit index
The sampler object to bind
Binds a vertex array object.
The vertex array object to bind, or null to unbind
Gets the color attachment constant for a given index.
The attachment index
The WebGL color attachment constant
Creates a new vertex array object.
A new WebGL vertex array object
Deletes a vertex array object.
The vertex array object to delete
Draws arrays with instancing support.
The primitive mode (GL_TRIANGLES, etc.)
The starting index in the enabled arrays
The number of vertices to draw
The number of instances to draw
Sets the draw buffers for multiple render targets.
Array of render buffer targets to draw to
Draws elements with instancing support.
The primitive mode (GL_TRIANGLES, etc.)
The number of indices to draw
The type of the index values
The offset in the index buffer
The number of instances to draw
Gets the maximum uniform block size aligned to the required offset alignment.
The aligned maximum uniform block size in bytes
Type guard to check if the context is WebGL2.
The WebGL context to check
True if the context is WebGL2, false otherwise
Gets the maximum number of uniform blocks that can be used in both vertex and fragment shaders.
The minimum of vertex and fragment shader uniform block limits
Gets the maximum number of uniform vectors available in fragment shaders.
The maximum fragment uniform vectors
Gets the maximum texture size.
The maximum texture size
Gets the maximum number of uniform vectors available in vertex shaders.
The maximum vertex uniform vectors
Gets the raw WebGL rendering context.
The underlying WebGL context (WebGL1 or WebGL2)
Gets the raw WebGL context cast as WebGL1.
The underlying WebGL context as WebGL1 type
Gets the raw WebGL context cast as WebGL2.
The underlying WebGL context as WebGL2 type
Gets WebGL memory usage information if the GMAN_WEBGL_MEMORY extension is available.
Memory information object or undefined if extension is not available
Checks if multiview rendering is supported and enabled.
True if multiview is available and enabled for WebVR
Sets the viewport with optimization to avoid redundant state changes.
Left coordinate of the viewport
Top coordinate of the viewport
Width of the viewport
Height of the viewport
Sets the viewport using a Vector4 with optimization to avoid redundant state changes.
Vector4 containing left, top, width, and height
Unbinds a 2D texture from a specific texture unit.
The texture unit index
Unbinds a 2D array texture from a specific texture unit.
The texture unit index
Unbinds a cube map texture from a specific texture unit.
The texture unit index
Unbinds all currently bound textures from all texture units. This is useful for cleanup operations.
Sets the divisor for instanced rendering for a vertex attribute.
The index of the vertex attribute
The divisor value (0 for per-vertex, 1+ for per-instance)
A wrapper class for WebGL context that provides enhanced functionality and state management. This class handles WebGL state optimization, extension management, and provides convenience methods for common WebGL operations while maintaining compatibility with both WebGL1 and WebGL2.