Re: [AD] question about opengl bitmaps

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Actually this is one of the worst things that can happen performance-wise. I did that mistake oncein a terrain renderer: switching between 4 textures made it run at ~20fps; sorting by texture allowed it to run at ~80fps.

Imo, it's better to create one texture and upload regions with glTexSubImage2D. It gets a bit more complicated once you want to support non-ascii scripts (you may need multiple glyph "sheets"), but it's manageable.

Also, a nice optimization is to use a 2d packer to pack glyphs on the texture, as this will save space once you start packing differently-sized glyphs. The premise is simple enough: use a bin-tree to partition the 2d space. On each glyph insertion, traverse the tree and cut a chunk (leaf) in the largest space (will either be in the horizontal or the vertical).


On 3/24/08, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
On the subject of fonts, I agree with Milan it should be locking once,
but also should it use sub-bitmaps rather than individual mini-bitmaps
for each glyph? In my copy of the Red Book it says that avoiding
texture changes is one way to improve performance. At the moment it
changes the texture for every character.

Pete




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/