Skip to main content

WebGLRenderer

Since version 4.0.0

Projection renderer, based on WebGL

class WebGLRenderer

Properties

Width / height ratio (= width / height)

Canvas element

Canvas's height (devicePixelRatio is not applied)

Current devicePixelRatio value.

Canvas's width (devicePixelRatio is not applied)

Methods

Destroy instance and release all resources.

Render projection

Render VR frame, only used for rendering frames inside VR sessions.

Resize canvas and renew inner size cache.

Constructor

Create new instance
new WebGLRenderer(canvas: HTMLCanvasElement, debug: boolean): WebGLRenderer

Parameters

canvas

HTMLCanvasElement

Canvas element

debug

boolean

Whether to enable WebGL debugging

Properties

ctx

readonly
ctx

WebGLContext

aspect

>=4.0.0
readonly
aspect

number

Width / height ratio (= width / height)

Example
const aspect = view360.renderer.width / view360.renderer.pixelRatio;
assert(aspect === view360.renderer.aspect);

canvas

>=4.0.0
readonly
canvas

HTMLCanvasElement

Canvas element

height

>=4.0.0
readonly
height

number

Canvas's height (devicePixelRatio is not applied)

pixelRatio

>=4.0.0
readonly
pixelRatio

number

Current devicePixelRatio value.

Example
cosnt renderingWidth = view360.renderer.width * view360.renderer.pixelRatio;

width

>=4.0.0
readonly
width

number

Canvas's width (devicePixelRatio is not applied)

Methods

destroy

>=4.0.0
destroy

void

destroy(): void

Destroy instance and release all resources.

render

>=4.0.0
render

void

render(mesh: TriangleMesh<CommonProjectionUniforms>, camera: Camera): void

Render projection

Parameters

mesh

TriangleMesh<CommonProjectionUniforms>

camera

renderVR

>=4.0.0
renderVR

void

renderVR(mesh: TriangleMesh<CommonProjectionUniforms>, vr: XRManager, frame: XRFrame): void

Render VR frame, only used for rendering frames inside VR sessions.

Parameters

mesh

TriangleMesh<CommonProjectionUniforms>

Triangle mesh to render

Instance of XRManager

frame

XRFrame

VR frame

resize

>=4.0.0
resize

void

resize(): void

Resize canvas and renew inner size cache.