Interface: SharedRendererOptions

SharedRendererOptions

Options for the shared systems of a renderer.

Properties:
Name Type Default Description
antialias boolean

Whether to enable anti-aliasing. This may affect performance.

autoDensity boolean

Resizes renderer view in CSS pixels to allow for resolutions other than 1.

background ColorSource

Alias for backgroundColor

backgroundAlpha number 1

Transparency of the background color, value from 0 (fully transparent) to 1 (fully opaque).

backgroundColor ColorSource 'black'

The background color used to clear the canvas. See ColorSource for accepted color values.

canvas ICanvas

The canvas to use as a view, optional.

clearBeforeRender boolean true

Whether to clear the canvas before new render passes.

context WebGL2RenderingContext | null null

User-provided WebGL rendering context object.

depth boolean

Whether to ensure the main view has can make use of the depth buffer. Always true for WebGL renderer.

height number 600

The height of the screen.

hello boolean false

Whether to log the version and type information of renderer to console.

manageImports boolean true
multiView boolean

TODO: multiView

powerPreference GpuPowerPreference undefined

An optional hint indicating what configuration of GPU is suitable for the WebGL context, can be 'high-performance' or 'low-power'. Setting to 'high-performance' will prioritize rendering performance over power consumption, while setting to 'low-power' will prioritize power saving over rendering performance.

preferWebGLVersion 1 | 2 2

The preferred WebGL version to use.

premultipliedAlpha boolean true

Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.

preserveDrawingBuffer boolean false

Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve its value until cleared or overwritten. Enable this if you need to call toDataUrl on the WebGL context.

resolution number

The resolution / device pixel ratio of the renderer.

skipExtensionImports boolean false

Whether to stop PixiJS from dynamically importing default extensions for the renderer. It is false by default, and means PixiJS will load all the default extensions, based on the environment e.g browser/webworker. If you set this to true, then you will need to manually import the systems and extensions you need.

e.g.

import 'accessibility';
import 'app';
import 'events';
import 'spritesheet';
import 'graphics';
import 'mesh';
import 'text';
import 'text-bitmap';
import 'text-html';
import { autoDetectRenderer } from 'pixi.js';

const renderer = await autoDetectRenderer({
  width: 800,
  height: 600,
  skipExtensionImports: true,
});
textureGCActive boolean true

If set to true, this will enable the garbage collector on the GPU.

textureGCAMaxIdle number 60 * 60

The maximum idle frames before a texture is destroyed by garbage collection.

textureGCCheckCountMax number 600

Frames between two garbage collections.

width number 800

The width of the screen.

Extends

  • ExtractRendererOptions
  • PixiMixins.RendererOptions

Members

antialias boolean

Whether to enable anti-aliasing. This may affect performance.

autoDensity boolean

Resizes renderer view in CSS pixels to allow for resolutions other than 1.

background ColorSource

Alias for backgroundColor

backgroundAlpha number

Transparency of the background color, value from 0 (fully transparent) to 1 (fully opaque).

Default Value:
  • 1

backgroundColor ColorSource

The background color used to clear the canvas. See ColorSource for accepted color values.

Default Value:
  • 'black'

canvas ICanvas

The canvas to use as a view, optional.

clearBeforeRender boolean

Whether to clear the canvas before new render passes.

Default Value:
  • true

context WebGL2RenderingContext | null

User-provided WebGL rendering context object.

Default Value:
  • null

depth boolean

Whether to ensure the main view has can make use of the depth buffer. Always true for WebGL renderer.

height number

The height of the screen.

Default Value:
  • 600

hello boolean

Whether to log the version and type information of renderer to console.

Default Value:
  • false

manageImports boolean Deprecated : since 8.1.6

Default Value:
  • true
See:
  • `skipExtensionImports`

multiView boolean

TODO: multiView

powerPreference GpuPowerPreference

An optional hint indicating what configuration of GPU is suitable for the WebGL context, can be 'high-performance' or 'low-power'. Setting to 'high-performance' will prioritize rendering performance over power consumption, while setting to 'low-power' will prioritize power saving over rendering performance.

Default Value:
  • undefined

preferWebGLVersion 1 | 2

The preferred WebGL version to use.

Default Value:
  • 2

premultipliedAlpha boolean

Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.

Default Value:
  • true

preserveDrawingBuffer boolean

Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve its value until cleared or overwritten. Enable this if you need to call toDataUrl on the WebGL context.

Default Value:
  • false

resolution number

The resolution / device pixel ratio of the renderer.

skipExtensionImports boolean

Whether to stop PixiJS from dynamically importing default extensions for the renderer. It is false by default, and means PixiJS will load all the default extensions, based on the environment e.g browser/webworker. If you set this to true, then you will need to manually import the systems and extensions you need.

e.g.

import 'accessibility';
import 'app';
import 'events';
import 'spritesheet';
import 'graphics';
import 'mesh';
import 'text';
import 'text-bitmap';
import 'text-html';
import { autoDetectRenderer } from 'pixi.js';

const renderer = await autoDetectRenderer({
  width: 800,
  height: 600,
  skipExtensionImports: true,
});
Default Value:
  • false

textureGCActive boolean

If set to true, this will enable the garbage collector on the GPU.

Default Value:
  • true

textureGCAMaxIdle number

The maximum idle frames before a texture is destroyed by garbage collection.

Default Value:
  • 60 * 60

textureGCCheckCountMax number

Frames between two garbage collections.

Default Value:
  • 600

width number

The width of the screen.

Default Value:
  • 800