Skip to content

v4 Migration Guide

Chad Engler edited this page Jul 12, 2017 · 1 revision

For those upgrading from v3 to v4 of PIXI.

Black sprites

If sprites are black or flickering, this might help for some devices:

PIXI.glCore.VertexArrayObject.FORCE_NATIVE = true;

Texture

Textures are clamped by default, in v3 they were repeated.

texture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;

Filters

Many of the filters have been externalized to pixi-filters with the exception of ColorMatrixFilter, BlurFilter, DisplacementFilter, FXAAFilter, NoiseFilter. All other filters, use pixi-filters.

You have to use mappedMatrix to convert textureCoord to mapCoord, all because of paddings and pow2.

Use filterClamp uniform to prevent bad things on edges (inputCoord.xy, filterClamp.xy, filterClamp.zw) , displacement and blur are good examples for that. See forum post for more information.

filter.uniforms now contains a direct map of uniform names to uniform values. Custom uniform data (mapping with objects specifying uniform type and value) is now stored in filter.uniformData.

DisplayObject

Setting the position of a DisplayObject no longer maintain the reference to the Point. The values of the point are assigned to the transform of the DisplayObject. For instance:

s.position = myPoint; // COPYING ASSIGNMENT! in v3 that was reference
s2.position = myPoint; //shadow sprite , same coord
myPoint.x = 10; // won't work

s.anchor = myPoint ; // DON'T do that please! we will fix it later

Text

font field is deprecated on the Text's style. Use fontFamily, fontWeight, fontSize etc. See corresponding pull-request.

TilingSprite

TilingSprite works bad with mipmap, and pow2 textures are mipmapped by default. We will fix that issue later, for now just

texture.baseTexture.mipmap = false;