Optimizations - part two

Hello kids,

As I promised you in one of my last posts I’m going to tell you some more information about optimizations in the code. Last time I ended at the situation, that physics processes took same time as the graphics ones. I’ve realized that I can’t do much more with the physics. So the only choice was to find some ways to optimize drawing functions.

I wouldn’t say that it is some kind of real optimization, but it’s more like write the code better way :) My intention was to minimize number of calling glDrawArray function, because it takes quite a bit of time and I was calling it so many times – ineffectively. So I tried to put as much images as possible into one triangle trip and drew it in one single call of glDrawArray.

Next thing I found out was that it is much more efficient to calculate coordinates of vertex by myself compared to using OpenGl transformation functions and to join some objects into one triangle strip through degenerated triangles, instead of drawing them separately.

I can guess that my experiences won’t help much other people, but what could really help is this guide book or this one. Both of them were very useful for me and other programmers can find there information that can improve their code.

Ok dears, thanks for reading my today’s post.


Granny Marie

3 komentáře:

  1. You are very cool!!! Keep on coding!
    All the bests from Hungary,

  2. Inspirational story and fun little game. Well done for all your hard work.

  3. Hi, I'm part of Candycane (you commented on our blog about our game Fling so I checked out your blog here) - I was wondering if you would be able to comment more exactly about how you managed to do multiple images at once .... like a code example showing first drawing a texture once, and then how to the same thing twice in one glDrawArrays command? I understand the general idea, but have never found an explanation/example of how exactly its implemented and am not too clear myself how to implement it exactly ... it would be really appreciated :)