0

I'm drawing text in OpenGL. The text moves and changes very frequently.

I have a bitmap font atlas (png and XML files) and am able to generate the texture coordinates for glyphs. Now I'm faced with how render the quads.

It occurs to me that immediate mode would be an extremely convenient way to do it. It seems rather troublesome to manage a buffer full of ever-changing glyph quads--setting up a pool allocator, all the mapping and unmapping to update the vertices, etc.. And I wonder if the performance improvement vs immediate mode would even be that great.

As a ballpark, there would probably be no more than a few hundred glyphs on screen at once.

What do you think? Would it be terribly wrong to use immediate mode for this?

rlkw1024
  • 6,225
  • 1
  • 34
  • 61
  • I would implement this the proper way to make sure I would reuse the code in the future. I've been paying a high price for my laziness in the past when it comes to quick and dirty immediate mode solutions. When it comes to bitmap font rendering it really depends on your needs. Do you need to render the text every frame, or can you simply render it to a texture once? If the latter is the case you could just generate a VBO with all the quads and UVs, then draw each letter separately using an offset and pass in position and scarling to the shader. No need to map and unmap. – Grimmy Dec 30 '12 at 14:21
  • What GL version are you using? – Grimmy Dec 30 '12 at 14:58

0 Answers0