Jump to content

Debugging in WebGL


robbo
 Share

Recommended Posts

If I try to use the Debug class, for example 'renderQuadTree' in the game render function I get the following error 'Cannot read property 'style' of null'.

 

This is because the game.context is null, (From the docs : A handy reference to renderer.context (only set for CANVAS games)) and it is null because the game is using WebGL over canvas.

 

How do I get the debug info to display in WebGL, or is there a way to force the came to use Canvas?

Link to comment
Share on other sites

Found the forcing to use Canvas, so obvious I missed it - doh

 

new Game(widthheightrendererparentstatetransparentantialias)

 

renderer number <optional> Phaser.AUTO

Which renderer to use: Phaser.AUTO will auto-detect, Phaser.WEBGL, Phaser.CANVAS or Phaser.HEADLESS (no rendering at all).

Link to comment
Share on other sites

But it would be actually nice to have debug drawing for WebGL too. I need to draw bouding box for selected sprite, now i have a sprite rectangle as a hack. But it looks bad if scaled. Or border for a map (no solution yet, can't use a sprite because of the size). I would like to keep WebGL if possible.

 

Are there plans to include geometry drawing (mainly lines, rectangle) for WebGL renderer?

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

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