glDrawFastAsHell

I took some time off from my remix level to look at the ToeTag source again. The editor was getting a little choppy when the entire level is visible and I wanted to see what I could do to fix that.

The answer, it seems, is glDrawArrays. Holy crap! It takes some massaging of the data each frame to get it into contiguous arrays but, man, once it’s in there you can blast polygons to the video card. I can now work on my level with the whole thing visible. There are lots of places I can leverage glDrawArrays still so it will only get faster in the future.

Once I get as much as I can drawing through arrays, I’ll post a new version of ToeTag.

Very happy!

Tags: ,

2 Responses to “glDrawFastAsHell”

  1. Owen Butler Says:

    Awesome stuff.

    I’ve used glDrawArrays in combination with glInterleavedArrays() and you are right, it really does eat polygons.

    You might be able to squeeze a heap more performance by using Vertex Buffer Objects if you are not already. Essentially, VBO’s allow you to store your Vertex/Normal/Texture/Indexes in video card memory. You can still use glDrawArrays() or glDrawElements() to draw (from the arrays now stored on the card), but you don’t transfer the whole scene over the bus to the card each frame.

    I imagine the nature of the data in your level editor is an almost perfect fit for speeding up with VBO’s. The scene would be drawn many times before being updated(the arrays changing). An update would at worst, approach the speed of using glDrawArrays() with client side arrays (The whole scene is updated and sent to the card).

  2. Warren Says:

    Huh, interesting. I’ll make a note to check those out as well then. Thanks for the heads up!

Leave a Reply