Jump to content
  • Advertisement
Sign in to follow this  
Wodzu

OpenGL Fastest way of drawing ARGB fonts?

This topic is 3027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!