transformFeedback()
ts
function transformFeedback<O, U>(
gl: WebGL2RenderingContext,
params: {
vertex: string;
attributes?: Record<string, Attribute>;
uniforms?: U;
outputs: Record<
O,
{
size: number;
}
>;
},
): TransformFeedbackPass<O, U>;Creates a Transform Feedback pass for GPGPU tasks without rendering to a texture.
It allows you to run a vertex shader and capture its output varyings into buffers that can then be read back by the CPU or used as input for another pass.
Type Parameters
O
O extends string
U
U extends Uniforms
Parameters
gl
WebGL2RenderingContext
The WebGL2 context.
params
Configuration for the transform feedback pass.
vertex
string
Vertex shader source. Should write to the output varyings.
attributes?
Record<string, Attribute> = {}
Vertex attributes (input buffers).
uniforms?
U = ...
Uniform values for the pass.
outputs
Record<O, { size: number; }>
Definition of the transform feedback output buffers. Maps varying names to their expected component size (e.g., 3 for vec3).
Returns
TransformFeedbackPass<O, U>