Jump to content

Phaser WebGL lineWidth Scaling Problem


Agerenon
 Share

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() {

    game.world.setBounds(0,0,200,200);

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

    box.lineStyle(.1,0xffffff,1);
    box.beginFill(0x008800);
    box.drawRect(0,0,1,1);
    box.endFill();
    box.scale.set(100);
}

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

 Share

  • Recently Browsing   0 members

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