Creates a new Rapid application instance.
Initialization options including the target canvas.
Background clear color [r, g, b, a], values range from 0 to 1.
The target HTMLCanvasElement.
The currently active rendering region.
The current device pixel ratio.
Counts the number of WebGL draw calls made in the current frame.
The active WebGL context.
Region dedicated to arbitrary geometry and shapes rendering.
Indicates whether we are currently writing to the stencil buffer to create a mask.
Logical height in CSS pixels, used for coordinate system and projection matrix.
Logical width in CSS pixels, used for coordinate system and projection matrix.
Direct access to the underlying matrix store.
Matrix stack for hierarchical transformations.
Maximum number of texture units supported by the device.
Physical height (canvas actual pixels = logical height * dpr).
Physical width (canvas actual pixels = logical width * dpr).
The current orthographic projection matrix (16 elements).
Indicates if the projection matrix has changed and needs to be uploaded to shaders.
Region dedicated to fast sprite rendering.
Manager for creating and organizing textures.
Pushes vertices for a circle geometry using TRIANGLES or similar primitives.
The radius of the circle.
Optionalcolor: ColorAn optional tint color.
The number of segments (polygons) used to approximate the circle.
Adds an individual vertex to the current graphics batch.
The relative X coordinate of the vertex.
The relative Y coordinate of the vertex.
The U texture coordinate (0 to 1).
The V texture coordinate (0 to 1).
The vertex color as a 32-bit unsigned integer.
Pushes vertices for a rectangle geometry. Should be enclosed by startGraphic and endGraphic.
The width of the rectangle.
The height of the rectangle.
Optionalcolor: ColorAn optional tint color.
Applies a chain of shaders to a texture sequentially using ping-pong RenderTextures. Each shader receives the output of the previous one as its input. Two internal RenderTextures are reused across calls (resized as needed).
The input texture to start the filter chain from.
An ordered array of CustomGlShader to apply in sequence.
The RenderTexture containing the final filtered result.
Draw it with rapid.drawSprite(result) to display it on screen.
Clears the active framebuffer applying the default background color.
Clears bounds created into the stencil mask.
The bitmask specifying which stencil layer to clear.
Clears a RenderTexture to a solid color. Must be called while the RT is the active render target (i.e. inside enterRenderTexture/leaveRenderTexture). Can also be called standalone — it will bind the RT, clear it, but NOT restore the main framebuffer.
Clear color. Defaults to transparent black (0, 0, 0, 0).
Draws a line geometry based on the provided options.
Line rendering options.
Optionalcolor: ColorAn optional tint color applied to the line.
OptionalcustomShader: GLShader | CustomGlShaderAn optional custom shader overriding the region's default shader.
OptionalcustomMatrix: numberAn optional custom matrix to use for transformation.
Utility method: Draws an image directly as a mask using a generic rectangle geometry.
The texture to be used as a mask.
OptionalcustomMatrix: numberDraws a rectangular sprite using the current world matrix from matrixStack.
The WebGL texture wrapper.
Optionalcolor: ColorAn optional tint color applied to the sprite.
OptionalcustomShader: GLShader | CustomGlShaderAn optional custom shader overriding the region's default shader.
OptionalcustomMatrix: numberFinishes the mask drawing phase and restores color buffer writing.
Ends the current graphics geometry definition, readying it for rendering.
Disables scissor clipping, restoring full-canvas rendering.
Enters a constrained rendering phase masked by the existing stencil buffer values.
Equality check type. Use "equal" to draw inside the mask, or "notEqual" to draw outside.
The reference value to test against.
The bitmask specifying which stencil bits to consider.
Enters a specific rendering region, flushing the previous one if necessary.
The rendering region to enter.
OptionalcustomShader: GLShader | CustomGlShaderAn optional custom shader to use for this region.
Exits the masked rendering phase, restoring default full-screen stencil values tests.
Flushes currently buffered rendering operations across all active regions.
Completes rendering to an offscreen render texture and reverts rendering back to the main canvas.
Resizes the canvas, updates internal viewport values, and recreates projection boundaries.
The new logical display width.
The new logical display height.
OptionalphysicsWidth: numberOptional new physical pixel width (canvas width).
OptionalphysicsHeight: numberOptional new physical pixel height (canvas height).
Configures the global WebGL blending behavior.
The targeted BlendMode to switch onto.
Starts drawing into the stencil buffer to construct a rendering mask.
The stencil reference value.
The stencil bitmask.
Starts rendering arbitrary graphics geometries.
The WebGL drawing mode (e.g., gl.TRIANGLES, gl.TRIANGLE_FAN).
Optionaltexture: TextureAn optional texture applied to the graphic vertices.
OptionalcustomShader: GLShader | CustomGlShaderAn optional custom shader overriding the region's default shader.
OptionalcustomMatrix: numberStarts rendering graphics explicitly for use as a mask, overriding the shader.
The WebGL drawing mode (e.g., gl.TRIANGLES).
Optionaltexture: TextureAn optional texture whose alpha channel may dictate masking rules.
OptionalcustomMatrix: numberEnables rectangular scissor clipping. Only pixels within the specified rectangle (in logical coordinates) will be rendered. Coordinates use the same system as your drawing calls (top-left origin).
Left edge in logical pixels.
Top edge in logical pixels.
Width in logical pixels.
Height in logical pixels.
The main application class for the Rapid rendering engine. Manages the WebGL context, rendering regions, state, and matrices.