Is instanced rendering used in GLSL faster than doing something like this..

for(int i=0; i<10; i++)
   glDrawArrays(GL_POINTS, 0, 3000);

Suppose I want to render 'grass', which is the best way when it comes to render one geometry multiple times.


closed as too broad by Anko, bummzack, concept3d, Philipp, Josh Dec 16 '13 at 17:23

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ It depends. The question is too broad. \$\endgroup\$ – Bartek Banachewicz Dec 12 '13 at 14:33

Only way to know is to profile the outcome.

Bascily this is faster, but when you have plenty of smaller objects that you only draw one-two objects of are usualy slower, but the bigger gain of the rest of the objects might give you higher gain which will hide this "penalty".

A rule of the thumb is to keep both ways around and imagine go for a minimum litmit with instancing. in other words, if X > 10 -> instancing, X < 10 single drawcalls.

But then again, it all comes down to profiling. only way to tell, only way to know.

  • \$\begingroup\$ Nice, i am trying to render grass, so its gonna be instancing. Cheers :) \$\endgroup\$ – 2am Dec 12 '13 at 14:32
  • 2
    \$\begingroup\$ For grass, i would even go with geometry shader, that way you can just create it on the fly without any bigger cpu overhead. \$\endgroup\$ – Tordin Dec 12 '13 at 14:34
  • \$\begingroup\$ hmm, interesting, I haven't really read much about geometry shaders, but i am aware of their usage. I will read about them tonight! :) \$\endgroup\$ – 2am Dec 12 '13 at 14:59
  • \$\begingroup\$ Depends on driver and hardware. A few years ago the instancing was slower than not-instancing while instancing was faster with D3D on the same machine. Especially with GL, performance is hard to predict. \$\endgroup\$ – Sean Middleditch Dec 12 '13 at 20:48
  • \$\begingroup\$ Thats why you really have to profile what is faster. \$\endgroup\$ – Tordin Dec 13 '13 at 8:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.