PIXI.settings

namespace settings

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


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

 // Disable interpolation when scaling, will make texture be pixelated
 PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;

Public Properties


ADAPTER settings.ts:69
static ADAPTER: PIXI.IAdapter = PIXI.BrowserAdapter

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.

ANISOTROPIC_LEVEL settings.ts:93
static ANISOTROPIC_LEVEL: number = 0

Default anisotropic filtering level of textures. Usually from 0 to 16

CAN_UPLOAD_SAME_BUFFER settings.ts:263
static CAN_UPLOAD_SAME_BUFFER: boolean

Can we upload the same buffer in a single frame?

CREATE_IMAGE_BITMAP settings.ts:272
static CREATE_IMAGE_BITMAP: boolean = false

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

FAIL_IF_MAJOR_PERFORMANCE_CAVEAT settings.ts:14
static FAIL_IF_MAJOR_PERFORMANCE_CAVEAT: boolean = false

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.

FILTER_MULTISAMPLE settings.ts:124
static FILTER_MULTISAMPLE: PIXI.MSAA_QUALITY = PIXI.MSAA_QUALITY.NONE

Default filter samples.

FILTER_RESOLUTION settings.ts:114
static FILTER_RESOLUTION: number = 1

Default filter resolution.

GC_MAX_CHECK_COUNT settings.ts:212
static GC_MAX_CHECK_COUNT: number = 600

Default Garbage Collection maximum check count.

GC_MAX_IDLE settings.ts:202
static GC_MAX_IDLE: number = 3600

Default Garbage Collection max idle.

GC_MODE settings.ts:192
static GC_MODE: PIXI.GC_MODES = PIXI.GC_MODES.AUTO

Default Garbage Collection mode.

MESH_CANVAS_PADDING settings.ts:3
static MESH_CANVAS_PADDING: number = 0

Default canvasPadding for canvas-based Mesh rendering.

See: PIXI.Mesh2d#canvasPadding
MIPMAP_TEXTURES settings.ts:82
static MIPMAP_TEXTURES: PIXI.MIPMAP_MODES = PIXI.MIPMAP_MODES.POW2

If set to true WebGL will attempt make textures mimpaped by default. Mipmapping will only succeed if the base texture uploaded has power of two dimensions.

PRECISION_FRAGMENT settings.ts:252
static PRECISION_FRAGMENT: PIXI.PRECISION = PIXI.PRECISION.MEDIUM

Default specify float precision in fragment shader. iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742

PRECISION_VERTEX settings.ts:242
static PRECISION_VERTEX: PIXI.PRECISION = PIXI.PRECISION.HIGH

Default specify float precision in vertex shader.

PREFER_ENV settings.ts:5
static PREFER_ENV: number = PIXI.ENV.WEBGL2

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.

Due to bug in chromium we disable webgl2 by default for all non-apple mobile devices.

RENDER_OPTIONS settings.ts:159
static RENDER_OPTIONS: object

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

Properties:
Name Type Attributes Default Description
antialias boolean

<optional>

false
autoDensity boolean

<optional>

false
backgroundAlpha number

<optional>

1
backgroundColor number

<optional>

0x000000
clearBeforeRender boolean

<optional>

true
height number

<optional>

600
legacy boolean

<optional>

false
preserveDrawingBuffer boolean

<optional>

false
useContextAlpha boolean

<optional>

true
view HTMLCanvasElement

<optional>

null
width number

<optional>

800
RESOLUTION settings.ts:104
static RESOLUTION: number = 1

Default resolution / device pixel ratio of the renderer.

RETINA_PREFIX settings.ts:3
static RETINA_PREFIX: RegExp = /@([0-9\.]+)x/

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

`@2x`
ROUND_PIXELS settings.ts:282
static ROUND_PIXELS: boolean = false

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.

SCALE_MODE settings.ts:232
static SCALE_MODE: PIXI.SCALE_MODES = PIXI.SCALE_MODES.LINEAR

Default scale mode for textures.

SORTABLE_CHILDREN settings.ts:3
static SORTABLE_CHILDREN: boolean = false

Sets the default value for the container property 'sortableChildren'. If set to true, the container will sort its children by zIndex value when updateTransform() is called, or manually if sortChildren() is called.

This actually changes the order of elements in the array, so should be treated as a basic solution that is not performant compared to other solutions, such as @link https://github.com/pixijs/pixi-display

Also be aware of that this may not work nicely with the addChildAt() function, as the zIndex sorting may cause the child to automatically sorted to another position.

SPRITE_BATCH_SIZE settings.ts:147
static SPRITE_BATCH_SIZE: number = 4096

The default sprite batch size.

The default aims to balance desktop and mobile devices.

SPRITE_MAX_TEXTURES settings.ts:134
static SPRITE_MAX_TEXTURES: number = 32

The maximum textures that this device supports.

STRICT_TEXTURE_CACHE settings.ts:22
static STRICT_TEXTURE_CACHE: boolean = false

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.

TARGET_FPMS settings.ts:3
static TARGET_FPMS: number = 0.06

Target frames per millisecond.

UPLOADS_PER_FRAME settings.ts:3
static UPLOADS_PER_FRAME: number = 4

Default number of uploads per frame using prepare plugin.

WRAP_MODE settings.ts:222
static WRAP_MODE: PIXI.WRAP_MODES = PIXI.WRAP_MODES.CLAMP

Default wrap modes that are supported by pixi.


Powered by webdoc!