Jump to content

Phaser WebGL lineWidth Scaling Problem


Recommended Posts

I don't know if this is a Phaser (or maybe PIXI) bug or simply my misuse of Phaser, so I thought I'd check with people on the forum first before submitting to Phaser github.

The following simple code snippet behaves differently in Phaser 2.6.1 depending upon whether you set it to use WebGL or the canvas.  And it appears to be an issue with lineWidth.

//var mode = Phaser.AUTO;
var mode = Phaser.CANVAS;
//var mode = Phaser.WEBGL;

var game = new Phaser.Game(200, 200, mode, 'test', { create: create });

function create() {


    var box = game.add.graphics(0,0);


If you run this snippet using CANVAS (as shown), then you get:phaser-canvas.PNG

If you run this snippet using WEBGL, then you get:phaser-webgl.PNG


In the first case, the outline and fill are appropriately together.  In the second, the outline is offset from the fill, and apparently misplaced.  From my characterization of the problem, it appears that the WebGL code is assuming that the lineWidth is an integer value, basically setting it to 1 given the offset of the box outline relative to its fill.

Should I file this as a bug with Phaser?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...