API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classWebGl2ShaderFilter
A high-level Filter subclass that renders the input texture through a user-provided GLSL fragment shader on the **WebGL2** backend. For the WebGPU backend use WebGpuShaderFilter. ## Usage ```ts const filter = new WebGl2ShaderFilter({ fragmentSource: ` #version 300 es precision mediump float; uniform sampler2D uTexture; uniform vec2 uResolution; uniform float uTime; in vec2 vUv; out vec4 fragColor; void main() { fragColor = texture(uTexture, vUv); } `, uniforms: { uTime: 0.0 }, }); // Update uniforms each frame: filter.uniforms.uTime = performance.now() / 1000; sprite.filters = [filter]; ``` ## Auto-bound uniforms The backend automatically sets `uTexture` (slot 0) and `uResolution` before each draw. User uniforms start at texture slot 1.
import { WebGl2ShaderFilter } from '@codexo/exojs' A high-level Filter subclass that renders the input texture through a user-provided GLSL fragment shader on the **WebGL2** backend.
For the WebGPU backend use WebGpuShaderFilter.
```ts const filter = new WebGl2ShaderFilter({ fragmentSource: ` #version 300 es precision mediump float; uniform sampler2D uTexture; uniform vec2 uResolution; uniform float uTime; in vec2 vUv; out vec4 fragColor; void main() { fragColor = texture(uTexture, vUv); } `, uniforms: { uTime: 0.0 }, });
// Update uniforms each frame: filter.uniforms.uTime = performance.now() / 1000; sprite.filters = [filter]; ```
The backend automatically sets `uTexture` (slot 0) and `uResolution` before each draw. User uniforms start at texture slot 1.
new(options: WebGl2ShaderFilterOptions): WebGl2ShaderFilter apply(backend: RenderBackend, input: RenderTexture, output: RenderTexture): void destroy(): void uniforms: Record<string, ShaderFilterUniformValue>