Constructs a new Rapid
instance with the given options.
Options for initializing the Rapid
instance.
Readonly
deviceReadonly
maxAdds a vertex to the current graphic being drawn.
Clears the canvas with the background color.
Optional
bgColor: ColorThe background color to clear the canvas with.
Clear the current mask by clearing the stencil buffer. This effectively removes any previously defined mask.
Creates a custom shader.
Vertex shader code.
Fragment shader code.
Shader type.
The created shader object.
Draw a mask. Automatically calls startDrawMask.
The type of mask to draw.
The callback function to execute.
Convenience method to render to a Frame Buffer Object Handles starting and ending the FBO rendering automatically
The Frame Buffer Object to render to
Callback function containing render commands to execute on the FBO
End the mask drawing process. This method configures the WebGL context to use the defined mask for subsequent rendering.
Ends rendering to a Frame Buffer Object Restores the default framebuffer and original viewport settings
Completes the graphic drawing process and renders the result.
Ends the rendering process by rendering the current region.
Registers a custom render region with a specified name.
The name of the region.
The class of the region to register.
Render
The function to render.
Renders a circle with the specified options.
The options for rendering the circle, including radius, position, color, and segment count.
Renders graphics based on the provided options.
The options for rendering the graphic, including points, color, texture, and draw type.
Renders a line with the specified options.
The options for rendering the line, including points, color, width, and join/cap types.
Renders a rectangle with the specified options.
The options for rendering the rectangle, including width, height, position, and color.
Renders a sprite with the specified options.
The rendering options for the sprite, including texture, position, color, and shader.
Renders a texture directly without additional options. This is a convenience method that calls renderSprite with just the texture.
The texture to render at the current transformation position.
Render a tile map layer.
The map data to render.
The options for rendering the tile map layer.
Resizes the canvas and updates the viewport and projection matrix.
Restores the matrix state from the stack.
Saves the current matrix state to the stack.
Sets the current render region by name and optionally a custom shader.
The name of the region to set as current.
Optional
customShader: GLShaderAn optional custom shader to use with the region.
Start drawing a mask using the stencil buffer. This method configures the WebGL context to begin defining a mask area.
Starts rendering to a Frame Buffer Object (FBO) Sets up the FBO for rendering by binding it, adjusting viewport size and projection
The Frame Buffer Object to render to
Starts the graphic drawing process.
The options for the graphic drawing, including shader, texture, and draw type.
Starts the rendering process, resetting the matrix stack and clearing the current region.
Whether to clear the matrix stack. Defaults to true.
Executes a callback function within a saved and restored matrix state scope.
The callback function to execute within the saved and restored matrix state scope.
The
Rapid
class provides a WebGL-based rendering engine.