Namespace: settings

PIXI.settings

User's customizable globals for overriding the default PIXI settings, such as a renderer's default resolution, framerate, float precision, etc.

Example

 import { settings, ENV } from 'pixi.js';

 // Use the native window resolution as the default resolution
 // will support high-density displays when rendering
 settings.RESOLUTION = window.devicePixelRatio;

 // Used for older v1 WebGL devices for backwards compatibility
 settings.PREFER_ENV = ENV.WEBGL_LEGACY;

Members

PIXI.settings.ADAPTER PIXI.IAdapter static

This adapter is used to call methods that are platform dependent. For example document.createElement only runs on the web but fails in node environments. This allows us to support more platforms by abstracting away specific implementations per platform.

By default the adapter is set to work in the browser. However you can create your own by implementing the IAdapter interface. See IAdapter for more information.

Default Value:
  • PIXI.BrowserAdapter

PIXI.settings.ANISOTROPIC_LEVEL number Deprecated : since 7.1.0 static

See:

PIXI.settings.CAN_UPLOAD_SAME_BUFFER boolean Deprecated : since 7.1.0 static

Can we upload the same buffer in a single frame?

See:

PIXI.settings.CREATE_IMAGE_BITMAP boolean static

Enables bitmap creation before image load. This feature is experimental.

Default Value:
  • false

PIXI.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT boolean static

Should the failIfMajorPerformanceCaveat flag be enabled as a context option used in the isWebGLSupported function. If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when using WebGL.

In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible. However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the browser.

If your application requires high performance rendering, you may wish to set this to false. We recommend one of two options if you decide to set this flag to false:

1: Use the pixi.js-legacy package, which includes a Canvas renderer as a fallback in case high performance WebGL is not supported.

2: Call isWebGLSupported (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS renderer, and show an error message to the user if the function returns false, explaining that their device & browser combination does not support high performance WebGL. This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.

Default Value:
  • false

PIXI.settings.FILTER_MULTISAMPLE PIXI.MSAA_QUALITY Deprecated : since 7.1.0 static

Default filter samples.

See:

PIXI.settings.FILTER_RESOLUTION number | unknown Deprecated : since 7.1.0 static

Default filter resolution.

See:

PIXI.settings.GC_MAX_CHECK_COUNT number Deprecated : since 7.1.0 static

Default Garbage Collection maximum check count.

See:

PIXI.settings.GC_MAX_IDLE number Deprecated : since 7.1.0 static

Default Garbage Collection max idle.

See:

PIXI.settings.GC_MODE PIXI.GC_MODES Deprecated : since 7.1.0 static

Default Garbage Collection mode.

See:

PIXI.settings.MESH_CANVAS_PADDING number Deprecated : since 7.1.0 static

Default canvasPadding for canvas-based Mesh rendering.

See:

PIXI.settings.MIPMAP_TEXTURES PIXI.MIPMAP_MODES Deprecated : since 7.1.0 static

See:

PIXI.settings.PRECISION_FRAGMENT PIXI.PRECISION Deprecated : since 7.1.0 static

Default specify float precision in fragment shader.

See:

PIXI.settings.PRECISION_VERTEX PIXI.PRECISION Deprecated : since 7.1.0 static

Default specify float precision in vertex shader.

See:

PIXI.settings.PREFER_ENV number static

The maximum support for using WebGL. If a device does not support WebGL version, for instance WebGL 2, it will still attempt to fallback support to WebGL 1. If you want to explicitly remove feature support to target a more stable baseline, prefer a lower environment.

Default Value:
  • PIXI.ENV.WEBGL2

PIXI.settings.RENDER_OPTIONS PIXI.IRendererOptions static

The default render options if none are supplied to PIXI.Renderer or PIXI.CanvasRenderer.

Properties:
Name Type Default Description
antialias boolean false

PIXI.IRendererOptions.antialias

autoDensity boolean false

PIXI.IRendererOptions.autoDensity

backgroundAlpha number 1

PIXI.IRendererOptions.backgroundAlpha

backgroundColor number 0x000000

PIXI.IRendererOptions.backgroundColor

clearBeforeRender boolean true

PIXI.IRendererOptions.clearBeforeRender

context null

PIXI.IRendererOptions.context

height number 600

PIXI.IRendererOptions.height

hello boolean false

PIXI.IRendererOptions.hello

powerPreference string default

PIXI.IRendererOptions.powerPreference

premultipliedAlpha boolean true

PIXI.IRendererOptions.premultipliedAlpha

preserveDrawingBuffer boolean false

PIXI.IRendererOptions.preserveDrawingBuffer

resolution number PIXI.settings.RESOLUTION

PIXI.IRendererOptions.resolution

width number 800

PIXI.IRendererOptions.width

PIXI.settings.RESOLUTION number static

Default resolution / device pixel ratio of the renderer.

Default Value:
  • 1

PIXI.settings.RETINA_PREFIX RegExp static

The prefix that denotes a URL is for a retina asset.

Default Value:
  • /@([0-9\.]+)x/
Example
`@2x`

PIXI.settings.ROUND_PIXELS boolean static

If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. Advantages can include sharper image quality (like text) and faster rendering on canvas. The main disadvantage is movement of objects may appear less smooth.

Default Value:
  • false

PIXI.settings.SCALE_MODE PIXI.SCALE_MODES Deprecated : since 7.1.0 static

See:

PIXI.settings.SORTABLE_CHILDREN boolean Deprecated : since 7.1.0 static

Sets the default value for the container property 'sortableChildren'.

See:

PIXI.settings.SPRITE_BATCH_SIZE number Deprecated : since 7.1.0 static

The default sprite batch size.

The default aims to balance desktop and mobile devices.

See:

PIXI.settings.SPRITE_MAX_TEXTURES number Deprecated : since 7.1.0 static

The maximum textures that this device supports.

See:

PIXI.settings.STRICT_TEXTURE_CACHE boolean static

If set to true, only Textures and BaseTexture objects stored in the caches (TextureCache and BaseTextureCache) can be used when calling Texture.from or BaseTexture.from. Otherwise, these from calls throw an exception. Using this property can be useful if you want to enforce preloading all assets with Loader.

Default Value:
  • false

PIXI.settings.TARGET_FPMS number Deprecated : since 7.1.0 static

Target frames per millisecond.

See:

PIXI.settings.UPLOADS_PER_FRAME number Deprecated : since 7.1.0 static

Default number of uploads per frame using prepare plugin.

See:

PIXI.settings.WRAP_MODE PIXI.WRAP_MODES Deprecated : since 7.1.0 static

See: