Re: [AD] question about opengl bitmaps

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


On Mon, 2008-03-24 at 23:05 +1100, Peter Wang wrote:
> On 2008-03-24, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> > As I understand it, that code is for pulling the image from VRAM into
> > main memory, so it can be modified and re-uploaded when the region is
> > unlocked. So I'm not sure why things seem to work if it is skipped. Is
> > it because the font bitmap is never modified while the glyphs are
> > being grabbed?
> 
> Ah, how could I miss that.  Can we somehow avoid that step in the usual case
> when the copy in main memory is already up to date?
> 

One solution would be to use ALLEGRO_MEMORY_BITMAP for the glyphs bitmap
- there's likely no need to have it loaded into a texture.

Another idea would be to keep a dirty-flag for each bitmap, simply
tracking whether any modification was done or not - then if no
modifications were done, there's no need to sync the memory copy.

Also, I think ALLEGRO_FORCE_LOCKING would have the side-effect of always
keeping the memory copy in sync, so in that case, the code to
re-download the texture data could be skipped. Would have to clarify
this in the docs though if this really should be enforced.

Similary, using ALLEGRO_LOCK_READONLY | ALLEGRO_LOCK_WRITEONLY might
work, but that would be kind of a hack. Sort of just trust that the
memory copy still has the right data - if we want that to work, also
would have to specify it in the docs.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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