Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebGL2

Hierarchy

  • WebGL2

Index

Constructors

constructor

  • new WebGL2(canvas: HTMLCanvasElement): WebGL2

Properties

Protected _activeProgram

_activeProgram: Program | null

Protected _activeTexture

_activeTexture: Texture | null

Protected _context

_context: WebGL2RenderingContext

Protected _programs

_programs: Array<Program | null>

Protected _textures

_textures: Texture[]

Protected _transformFeedbacks

_transformFeedbacks: Array<TransformFeedback | null>

Methods

activateProgram

  • activateProgram(program: Program): void
  • Activates a program and deactivates the previous program. Throws an error when the program is not attached to WebGL2.

    Parameters

    Returns void

activateProgramByID

  • activateProgramByID(id: number): void
  • Activates a program by ID and deactivates the previous program. Throws an error when the ID does not exist.

    Parameters

    • id: number

    Returns void

activateTexture

  • activateTexture(texture: Texture): void

addProgram

  • addProgram(program: Program): number
  • Adds the program to the WebGL2 and returns ID number of the program. If any program is activated yet, this method activates the program.

    Parameters

    Returns number

    Program ID

addTexture

  • addTexture(texture: Texture): void

addTransformFeedback

clear

  • clear(mask?: number): void
  • Parameters

    • Default value mask: number = COLOR_BUFFER_BIT

    Returns void

clearColor

  • clearColor(r: number, g: number, b: number, a: number): void
  • Parameters

    • r: number
    • g: number
    • b: number
    • a: number

    Returns void

deactivateProgram

  • deactivateProgram(program: Program): void

disable

  • disable(cap: number): void

draw

  • draw(mode: number, count?: number | null): void
  • Parameters

    • mode: number
    • Default value count: number | null = null

    Returns void

enable

  • enable(cap: number): void

useProgram

  • useProgram(program: Program): void
  • Uses the program as a current program.

    Parameters

    Returns void

useProgramByID

  • useProgramByID(id: number): void
  • Uses the program as a current program.

    Parameters

    • id: number

    Returns void

viewport

  • viewport(x: number, y: number, width: number, height: number): void
  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns void

Generated using TypeDoc