Class PostProcess

The PostProcess class represents a post-processing effect that can be applied to the game.

Constructors

Properties

game: Game

The game object.

gl: WebGL2RenderingContext

The WebGL rendering context.

glCanvas: HTMLCanvasElement = ...

The WebGL canvas element.

glGeometryBuffer: WebGLBuffer

The WebGL buffer for the geometry.

glPostShader: WebGLProgram

The WebGL program used for rendering the post-processing effect.

glPostTexture: WebGLTexture

The WebGL texture used for rendering the post-processing effect.

glUniforms: Record<string, any> = {}

The uniforms used for rendering the post-processing effect.

Methods

  • Compiles a shader from the provided source code.

    Parameters

    • source: string

      The source code of the shader.

    • type: number

      The type of the shader (e.g., gl.VERTEX_SHADER or gl.FRAGMENT_SHADER).

    Returns WebGLShader

    The compiled shader.

  • Creates a WebGL program using the provided vertex and fragment shaders.

    Parameters

    • vs: string

      The vertex shader source code.

    • fs: string

      The fragment shader source code.

    Returns WebGLProgram

    The created WebGL program.

  • Creates a WebGL texture from the given image.

    Parameters

    • Optionalimage: TexImageSource

      The image to be used as the texture. If not provided, an empty texture will be created.

    Returns WebGLTexture

    The created WebGL texture.