Suggestions for using bitmap fonts

Blitz3D Forums/Blitz3D Programming/Suggestions for using bitmap fonts

Leto(Posted 2006) [#1]
I'm hoping to get some suggestions for using bitmap fonts in an optimal way (3D game in Blitz3D).

I have a 512x512 bitmap font grid (done in Bitmap Font Creator or something) and have come up with code which loads the image as a texture, stores the UV co-ords for each character, and creates a mesh with two-tris per character (vertex colours is quite cool for colouring the text; dev shot here: kauler.com/games/explosiverpg/progress_a_04b.jpg ).

However I realised that creating meshes on-the-fly for every piece of text doesn't seem like a good idea -- plus the poly count increase. But I'm not familiar enough with how I could render the bitmap font to the screen in another way (like DrawImage()...?)

Some text can be pre-generated (e.g. "Health:", others need to be realtime (e.g. damage numbers "59")


Stevie G(Posted 2006) [#2]
If it's 3d don't use drawimage as this could cause issues with graphics cards.

Rather then recreate the text each frame ( which is pretty fast and not much of an overhead ) you could create the initial text mesh and simply adjust the uv coords for each created quad to display the appropriate letter.

Can't think of a faster way tbh.

Stevie


Leto(Posted 2006) [#3]
Ok thanks, Stevie. I wouldn't create text every frame, no, but there may be a performance hit if, say, the user opens a GUI window containing many pieces of text.

I guess I'll have to use a combo of pre-created mesh, with CopyEntity+adjustments, and some kind of "text mesh history" array or type.


markcw(Posted 2006) [#4]
> If it's 3d don't use drawimage as this could cause issues with graphics cards.

could you elaborate on this Stevie?

what issues?


Stevie G(Posted 2006) [#5]
Well some newer graphics cards don't support 2d too well so mixing 2d over 3d can cause major slow down on some newer cards. You may find it works fine for you but won't for others.

This has been reported by countless people over the years and it does happen with my lowly gfx440mx. Better to use a 2din3d pixel perfect lib in my experience.

Stevie


markcw(Posted 2006) [#6]
oh right, thanks. i see, i couldn't think what issues you meant. i was wondering if there were some gfx cards that won't render images in 3d at all. ?!

yeah, there is some slowdown, but also even slower than that is drawing lines, circles, etc.