Skip to content

rawRenderPass() ​

ts
function rawRenderPass<U extends UniformValues>(params: {
  gl?: WebGL2RenderingContext;
  target?: RenderTarget | null;
  fragment: string;
  vertex: string;
  attributes?: Record<string, Attribute>;
  uniforms?: U;
  blending?: "none" | "normal" | "additive";
  depthTest?: boolean;
  drawMode?:
    | "POINTS"
    | "LINES"
    | "LINE_STRIP"
    | "LINE_LOOP"
    | "TRIANGLES"
    | "TRIANGLE_STRIP"
    | "TRIANGLE_FAN";
  transformFeedbackVaryings?: string[];
  resolutionScale?: number;
}): RawRenderPass<U>;

Creates a low-level rendering pass for concrete uniform values.

This is the core primitive for rendering anything to the screen or a texture. It handles program creation, concrete uniform management, attribute setup, render-target selection, state configuration, and resizing.

This pass deliberately does not evaluate uniform functions or promises. Use renderPass() for managed uniform sources.

Type Parameters ​

U ​

U extends UniformValues

Parameters ​

params ​

Configuration for the render pass.

gl? ​

WebGL2RenderingContext

Optional WebGL2 context used to initialize the pass immediately.

Passes without a context are initialized by calling pass.initialize(gl) or using the compositor. Calling initialize() multiple times with the same context is a no-op.

target? ​

| RenderTarget | null = null

Optional initial render target for the pass. If not provided, it will render directly to the canvas or can be set later.

fragment ​

string

Fragment shader source code.

vertex ​

string

Vertex shader source code.

attributes? ​

Record<string, Attribute> = {}

Mapping of attribute names to their data and configuration.

uniforms? ​

U = ...

Initial concrete uniform values. Functions and promises are resolved by higher-level APIs such as renderPass() before rendering.

blending? ​

"none" | "normal" | "additive" = "none"

Blending mode to use for this pass.

Default

ts
"none";

depthTest? ​

boolean = false

Whether to enable depth testing.

Default

ts
false;

drawMode? ​

| "POINTS" | "LINES" | "LINE_STRIP" | "LINE_LOOP" | "TRIANGLES" | "TRIANGLE_STRIP" | "TRIANGLE_FAN"

WebGL draw mode.

Default

"POINTS" if gl_PointSize is found in the vertex shader, otherwise "TRIANGLES".

transformFeedbackVaryings? ​

string[]

Array of varying names for Transform Feedback.

resolutionScale? ​

number = 1

Scaling factor applied to the resolution when the pass is resized.

Default

ts
1;

Returns ​

RawRenderPass<U>

Released under the MIT License.