Fastest way of drawing ARGB fonts?

Started by
2 comments, last by Clapfoot 14 years ago
Hi guys. I am working on a RPG game, I need atleast hundreds of letters displayed on screen at one time. The font must be nice, with alpha channel. I saw one solution which is based on binding textures to quads. Each letter has been compiled into display list and has own texture binded to quad. But I am thinking about the other solution. Why not to use glDrawPixels()? Which method is faster? I am hoping for your advice cause I am a OpenGL beginner and do not know which method to chose. Thanks!
Just started...
Advertisement
Why are you thinking of other solutions? The quads method is both the fastest and pretty much the easiest!

Seriously, the only options you have are to either make prebuilt quads for each letter and use a transform to place them in the right places, or pile the lot dynamically into a vertex buffer. I do the latter, the former works ok too.

Anything else is gonna be crap. If you're using hardware acceleration, you can't go around locking and unlocking textures and stuff as it will kill performance very badly unless you jump through a lot of hoops.

It sounds like you won't really be pushing the hardware anyway, so in your case the drawpixels option might actually pan out, but imo it's a bad habit to learn. you admit to being a beginner, so better to learn how to do it properly and it really isn't that hard once you dive in.
------------------------------Great Little War Game
Thanks for your advice.

But why do I need to lock texture? I do not need copy particular letters from the texture, I might keep letters as the image data in memory. I can call glDrawPixels with a pointer to the memory with data...

Just started...
Is your text going to be changing dynamically during runtime? If not, I recommend you create a static vertex buffer object full of quads (indexed if possible) at load time and use that to draw every frame. If your text will be dynamically changing then use a dynamic vertex buffer object instead.

If theres a chance your using OpenGL ES then then OES_draw_texture extension would probably be the fastest method.

Ultimately, the best way would be to try out several methods and pick the fastest solution.

This topic is closed to new replies.

Advertisement