Viewport

Viewport

A viewport class for managing WebGL viewports.

Constructor

new Viewport(spec)

Instantiates a Viewport object.
Source:
Parameters:
Name Type Description
spec Object The viewport specification object.
Name Type Description
width number The width of the viewport.
height number The height of the viewport.

Methods

pop() → {Viewport}

Pops current the viewport object and sets the viewport beneath it.
Source:
Returns:
Type:
Viewport
The viewport object, for chaining.

push(x, y, width, height) → {Viewport}

Sets the viewport dimensions and position. The underlying canvas element is not affected.
Source:
Parameters:
Name Type Default Description
x number 0 The horizontal offset override.
y number 0 The vertical offset override.
width number The width override.
height number The height override.
Returns:
Type:
Viewport
- The viewport object, for chaining.

resize(width, height) → {Viewport}

Updates the viewports width and height. This resizes the underlying canvas element.
Source:
Parameters:
Name Type Default Description
width number 0 The width of the viewport.
height number 0 The height of the viewport.
Returns:
Type:
Viewport
The viewport object, for chaining.