Sign in to follow this  
Wodzu

OpenGL Fastest way of drawing ARGB fonts?

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this