Create a new QuadRender instance.
The shader to be used to render the quad.
Destroys the resources associated with this instance.
Renders the quad. If the viewport is provided, the original viewport and scissor is restored after the rendering.
Optionalviewport: Vec4
The viewport rectangle of the quad, in pixels. The viewport is not changed if not provided.
Optionalscissor: Vec4
The scissor rectangle of the quad, in pixels. Used only if the viewport is provided.
OptionalnumInstances: number
Number of instances to draw. When provided, renders
multiple quads using instanced drawing. Each instance can use the instance index
(gl_InstanceID in GLSL, pcInstanceIndex in WGSL) to fetch per-quad data from
a texture or buffer, allowing each quad to be parameterized independently.
An object that renders a quad using a Shader.
Note: QuadRender does not modify render states. Before calling render, you should set up the required states using GraphicsDevice#setDrawStates, or the individual setters (GraphicsDevice#setBlendState, GraphicsDevice#setCullMode, GraphicsDevice#setFrontFace, GraphicsDevice#setDepthState, GraphicsDevice#setStencilState). Otherwise previously set states will be used.
Example: