Fix Pixi flickering on some mobile phones (#566)

* Fix flickering on some mobile devices (Android/Ubuntu Touch)
This commit is contained in:
Wend1go
2018-07-30 17:55:58 +02:00
committed by Florian Rival
parent b6707d62b2
commit 35e3015d66

View File

@@ -37,8 +37,12 @@ gdjs.RuntimeGameRenderer = gdjs.RuntimeGamePixiRenderer; //Register the class to
gdjs.RuntimeGamePixiRenderer.prototype.createStandardCanvas = function(canvasArea) {
this._canvasArea = canvasArea;
//This prevents flickering on some mobile devices
PIXI.glCore.VertexArrayObject.FORCE_NATIVE = true;
//Create the renderer and setup the rendering area
this._pixiRenderer = PIXI.autoDetectRenderer(this._game.getDefaultWidth(), this._game.getDefaultHeight());
//"transparent: true" is needed to avoid flickering issues on some mobile phones (see #566)
this._pixiRenderer = PIXI.autoDetectRenderer(this._game.getDefaultWidth(), this._game.getDefaultHeight(), {transparent: true} );
canvasArea.style["position"] = "absolute";
canvasArea.appendChild(this._pixiRenderer.view); // add the renderer view element to the DOM
canvasArea.tabindex = "1"; //Ensure that the canvas has the focus.