robbo Posted January 17, 2014 Share Posted January 17, 2014 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 More sharing options...
robbo Posted January 17, 2014 Author Share Posted January 17, 2014 Found the forcing to use Canvas, so obvious I missed it - doh new Game(width, height, renderer, parent, state, transparent, antialias) 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 More sharing options...
XekeDeath Posted January 17, 2014 Share Posted January 17, 2014 I was writing a reply, then my browser crashed, and I see you already found the answer. Link to comment Share on other sites More sharing options...
neon Posted January 17, 2014 Share Posted January 17, 2014 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 More sharing options...
neoRiley Posted January 31, 2014 Share Posted January 31, 2014 I'd just like to put my vote in for line drawing in 3D space as well. Very useful for so many situations, not just debugging. But it's huge for debugging Link to comment Share on other sites More sharing options...
Recommended Posts