Skip to main content

Class: RenderContext

Defined in: rendering/render-context.ts:10

The rendering context.

Constructors

Constructor

new RenderContext(shaderCache, imageCache, canvas, clearStrategy): RenderContext

Defined in: rendering/render-context.ts:41

Constructs a new instance of the RenderContext class.

Parameters

shaderCache

ShaderCache

The shader cache.

imageCache

ImageCache

The image cache.

canvas

HTMLCanvasElement

The canvas element.

clearStrategy

CLEAR_STRATEGY_KEYS = CLEAR_STRATEGY.blank

The strategy for clearing the render context (default: CLEAR_STRATEGY.blank).

Returns

RenderContext

Properties

canvas

readonly canvas: HTMLCanvasElement

Defined in: rendering/render-context.ts:25

The canvas element associated with the render context.


clearStrategy

clearStrategy: CLEAR_STRATEGY_KEYS

Defined in: rendering/render-context.ts:12

The strategy for clearing the render context.


gl

readonly gl: WebGL2RenderingContext

Defined in: rendering/render-context.ts:28

The WebGL2 rendering context.


imageCache

readonly imageCache: ImageCache

Defined in: rendering/render-context.ts:22

The image cache containing loaded images.


instanceBuffer

instanceBuffer: WebGLBuffer

Defined in: rendering/render-context.ts:30


shaderCache

readonly shaderCache: ShaderCache

Defined in: rendering/render-context.ts:17

The shader store containing compiled shaders.

Methods

getGlobalUniformValue()

getGlobalUniformValue(name): UniformValue

Defined in: rendering/render-context.ts:85

Parameters

name

string

Returns

UniformValue


resize()

resize(width, height): void

Defined in: rendering/render-context.ts:68

Resizes the render context canvas and updates the WebGL viewport.

Parameters

width

number

The new canvas width in pixels.

height

number

The new canvas height in pixels.

Returns

void


setGlobalUniformValue()

setGlobalUniformValue(name, value): void

Defined in: rendering/render-context.ts:80

Parameters

name

string

value

UniformValue

Returns

void