Ties the context to a given canvas element. This can only be called once and needs to be called, before any rendering can take place.
The canvas element to render to
Additional settings for context creation, passed to the canvas element.
See WebGLContextAttributes
.
{ alpha: true }
is used unless explicitly overwritten.
Note that { alpha: false }
can lead to major performance issues on some platforms.
Returns the WebGL2RenderingContext
of the canvas element it's tied to once available.
The underlying WebGL2RenderingContext
.
Returns an array of supported compressed texture formats once available.
An array of supported compressed texture formats.
Returns an array of supported ASTC profiles once available.
An array of supported ASTC profiles.
Generated using TypeDoc
The rendering context, tied to a canvas element.
Most of the time, you won't need to manually create a context.
The
defaultContext
is, as the name suggests, the context that is used, unless another one is manually specified. It still needs to be initialized:If you'd rather manage your own context, you can do so by providing each object with your context upon instantiation:
Remember to do so on every object you create – using objects across multiple contexts is currently not supported.