question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

About performance of `indexBuffer` & `drawElements`.

See original GitHub issue

recently , I try to create some examples about shader (just for studying), so I don’t use PIXI. I use a simple webgl wrapper igloojs at https://github.com/skeeto/igloojs

And I found a strange thing :
When I just render thousands of sprite (use same texture , so they’re batch) ---- no motion , no animation, no transform, no shader ,no filter ,no any effect, just “stand & still” , the igloojs is faster than pixi very much , very very very much , at least 3x. Even I try to use PIXI.glCore directly to render texture (similar to http://dev.goodboydigital.com/client/goodboy/million/ , but no physics, no particles shader), the igloojs is still faster very much.

So I read the code , I found the biggest difference is that igloojs use drawArrays(TRIANGLES...) , and no indexBuffer , I have to set the 6 vert manually.

And I found use drawArrays(gl.TRIANGLES...) is faster than gl.drawElements(gl.TRIANGLES...).

Is indexBuffer & drawElements the hotspot of performance ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
finscncommented, Nov 2, 2017

I refactor http://dev.goodboydigital.com/client/goodboy/million/ , create 2 new versions

with drawElements ( 25 fps on my MacBookPro 2015) http://fatidol.com/million-bunnies/draw-elements.html
(only support max 16384 sprites, Whatever set how many bunnies , it’s always less than 16384.)

with drawArrays ( 40 fps on my MacBookPro 2015) http://fatidol.com/million-bunnies/draw-arrays.html

You could find draw-arrays is more fast than draw-elements

0reactions
lock[bot]commented, Feb 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

About performance of indexBuffer & drawElements . #4399
recently , I try to create some examples about shader (just for studying), so I don't use PIXI. I use a simple webgl...
Read more >
Tutorial 9 : VBO Indexing
The index buffer contains integers, three for each triangle in the mesh, which reference the ... glDrawElements( GL_TRIANGLES, // mode indices.size(), ...
Read more >
Android Lesson Eight: An Introduction to Index Buffer Objects ...
In this lesson, we'll learn about index buffer objects, and go over a practical example of how to use them. Here's what we're...
Read more >
Tutorial 10 - Indexed Draws - OGLdev
We use glDrawElements instead of glDrawArrays. The first parameter is the primitive type to render (same as glDrawArrays). The second parameter is the...
Read more >
Performance of glDrawElements vs glDrawRangeElements vs ...
The groups are about 60k vertices each. Say 4 are twice the size (120) and 9 are smaller or about 60k. I'm only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found