hexdecks Posted January 21, 2015 Share Posted January 21, 2015 Hi Guys, I'm drawing an isometric grid with mouse-over hit area detection over each tile. It works but the frame rates are awful. Any idea what is bringing the frame-rates down so much? Surely, webGL is capable of attaining better FPS than this? What am I doing that is particularly taxing for the browser? There are no moving sprites (only diamond-shapes PIXI.Graphics) drawn to the screen. ps. I can get about 45,000 moving sprites on bunnymark at 30fps. http://178.79.155.146/pc Cheers,Jordan Quote Link to comment Share on other sites More sharing options...
msha Posted January 21, 2015 Share Posted January 21, 2015 Graphics objects are not that fast, use sprites instead. You can create sprites from Graphics this way:tileTexture = myTileGraphics.generateTexture();..................tileSprite = new PIXI.Sprite(tileTexture); hexdecks 1 Quote Link to comment Share on other sites More sharing options...
hexdecks Posted January 21, 2015 Author Share Posted January 21, 2015 Graphics objects are not that fast, use sprites instead. You can create sprites from Graphics this way:tileTexture = myTileGraphics.generateTexture();..................tileSprite = new PIXI.Sprite(tileTexture); Interesting, thanks for this. Out of interest - do you know why this is? Are sprites drawn in a different way to graphics objects?(Probably more of a webGL issue possibly?) Quote Link to comment Share on other sites More sharing options...
msha Posted January 21, 2015 Share Posted January 21, 2015 Interesting, thanks for this. Out of interest - do you know why this is? Are sprites drawn in a different way to graphics objects?(Probably more of a webGL issue possibly?)I think it has to do with how opengl primitives are batched together. hexdecks 1 Quote Link to comment Share on other sites More sharing options...
xerver Posted January 22, 2015 Share Posted January 22, 2015 With primitives we have to draw them to the stencil buffer each frame, then render that to the render buffer. With a sprite it is a single draw call to show the texture. If you have many sprites with the same texture we can batch them all together in a single draw call (we can't do that with Graphics). That is the short version. hexdecks 1 Quote Link to comment Share on other sites More sharing options...
dirkk0 Posted January 22, 2015 Share Posted January 22, 2015 I also switched to Sprites for this reason:http://www.html5gamedevs.com/topic/10482-heydey-isometric-tiles-in-pixijs/ hexdecks 1 Quote Link to comment Share on other sites More sharing options...
hexdecks Posted January 23, 2015 Author Share Posted January 23, 2015 With primitives we have to draw them to the stencil buffer each frame, then render that to the render buffer. With a sprite it is a single draw call to show the texture. If you have many sprites with the same texture we can batch them all together in a single draw call (we can't do that with Graphics). That is the short version. I also switched to Sprites for this reason:http://www.html5gamedevs.com/topic/10482-heydey-isometric-tiles-in-pixijs/ Really useful guys, thank-you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.