The renderer that owns this context.
Optionaloptions: DrawingContextOptions
The options for this context.
The alpha strategy to use when rendering. Shaders can opt in to alpha strategies via this value. Typically, this is used to switch from floating-point alpha to a fragment discard strategy for use in stencil rendering.
Which renderbuffers in the framebuffer to clear when the DrawingContext comes into use. This is the mask of buffers to clear: gl.COLOR_BUFFER_BIT, gl.DEPTH_BUFFER_BIT, gl.STENCIL_BUFFER_BIT.
The blend mode to use when rendering. This is an index into the renderer's blendModes array. It is faster to check than the state object.
ReadonlycameraThe camera used by this context. Set this using setCamera to ensure
the view matrix is updated. Ensure that this is not null before
rendering.
Whether to enable mipmaps on the framebuffer texture, if it exists. The game must still be set to use mipmaps for this to work.
The WebGLFramebufferWrapper which will hold the framebuffer output. This may contain the canvas.
The height of the framebuffer.
The last time the DrawingContext was used. This is used to determine whether the context is a candidate for reuse in a pool.
The pool to return to when this context is no longer needed. Used only for temporary contexts.
The renderer that owns this context.
Relevant WebGL state for the DrawingContext. Contains the framebuffer, scissor box, and viewport.
The WebGLTextureWrapper which will hold the framebuffer output.
This is only used if useCanvas is false.
Whether to use the canvas as the framebuffer.
The width of the framebuffer.
Begin drawing with the DrawingContext.
This should be called before rendering to set up the framebuffer and other WebGL state.
Clear the framebuffer. This will bind the framebuffer.
Optionalbits: number
A bitmask of WebGL buffer bits to clear (e.g. gl.COLOR_BUFFER_BIT, gl.DEPTH_BUFFER_BIT, gl.STENCIL_BUFFER_BIT). Defaults to the autoClear value of this context.
Copy the state of another DrawingContext.
The DrawingContext to copy from.
Destroys the DrawingContext and its resources.
Create a clone of the DrawingContext. This is intended to be mutated for temporary use, and then thrown away.
The autoClear setting is set to false unless specified. This is because most clones reference an existing framebuffer, which is intended to accumulate drawing operations.
OptionalpreserveAutoClear: boolean
Whether to preserve the autoClear setting. Default false.
The cloned DrawingContext.
Check whether the DrawingContext is locked.undefined
Whether the DrawingContext is locked.
Lock the DrawingContext to be in use.
This prevents release from returning it to its pool
until unlock is called with the appropriate key.
This is used for temporary DrawingContexts,
which may be returned to a pool.
The key to lock the DrawingContext with.
End using the DrawingContext. This marks the context as not in use, so its framebuffer and texture are not needed any more and may be cleared at any time. This will finish any outstanding batches.
If there are no locks on the DrawingContext, and it comes from a pool, it will be returned to its pool.
Resize the DrawingContext.
If no framebuffer exists yet, a new texture and framebuffer are created at the given dimensions. If a framebuffer already exists, it is resized in place. The scissor box and viewport are reset to match the new size.
The new width of the framebuffer.
The new height of the framebuffer.
Set the alpha strategy for the DrawingContext.
The alpha strategy to use when rendering.
Set the buffers to clear when the DrawingContext comes into use.
Whether to clear the color buffer.
Whether to clear the depth buffer.
Whether to clear the stencil buffer.
Set the blend mode for the DrawingContext.
The blend mode to set.
OptionalblendColor: number[]
The blend color to set. This is an array of 4 values: red, green, blue, alpha.
Set the clear color for the DrawingContext. No changes will be made if the color is the same as the current clear color.
The red component of the color to clear with.
The green component of the color to clear with.
The blue component of the color to clear with.
The alpha component of the color to clear with.
Set the color writemask for the DrawingContext.
Whether to write the red channel.
Whether to write the green channel.
Whether to write the blue channel.
Whether to write the alpha channel.
Set the scissor box for the DrawingContext.
The x coordinate of the scissor box.
The y coordinate of the scissor box.
The width of the scissor box.
The height of the scissor box.
Enable or disable the scissor box for the DrawingContext.
Whether to enable the scissor box.
Set the stencil parameters for the DrawingContext.
Optionalenabled: boolean
Whether the stencil test is enabled. Default true.
Optionalfunc: number
The stencil comparison function used to compare the reference value against the current stencil buffer value. Default GL_EQUAL.
OptionalfuncRef: number
The reference value against which the stencil buffer value is compared during the stencil test. Default 0.
OptionalfuncMask: number
The bitwise mask applied to both the reference value and the stencil buffer value before they are compared. Default 0xFF.
OptionalopFail: number
The operation to perform if the stencil test fails. Default GL_KEEP.
OptionalopZfail: number
The operation to perform if the stencil test passes but the depth test fails. Default GL_KEEP.
OptionalopZpass: number
The operation to perform if the stencil test passes and the depth test passes or is disabled. Default GL_KEEP.
Optionalclear: number
The value to clear the stencil buffer to. Default 0.
OptionalwriteMask: number
The mask applied to the stencil buffer value when it is written. Set to 0 to prevent writing. Set to 0xFF to allow full writing. Default 0x00.
Unlock the DrawingContext.
This allows release to return it to its pool.
The key to unlock the DrawingContext with. This must be the same key used to lock it.
Optionalrelease: boolean
Whether to release the DrawingContext immediately. This will only happen if there are no other locks on it.
Begin using the DrawingContext. This will finish any outstanding batches and run any autoClear.
DrawingContext