Re: [AD] power-of-two textures? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] power-of-two textures?
- From: Elias Pschernig <elias@xxxxxxxxxx>
- Date: Mon, 11 Feb 2008 15:11:24 +0100
On Tue, 2008-02-12 at 00:45 +1100, Peter Wang wrote:
>
> > Another problem is maximum texture size. In theory, old drivers might
> > have a limit as low as 256x256 - but I guess every normally we could
> > expect at least 2048x2048. Still, if the user creates a 3000x500 bitmap,
> > I don't think this should be allowed to fail. So in a similar way, my
> > idea is to allow "composed bitmaps". Those are bitmaps consisting of
> > multiple smaller ones.
>
> How would al_lock_bitmap work on them?
Hm, good question. One idea would be to slightly change the locking API:
Instead of the current:
ALLEGRO_LOCKED_REGION *
al_lock_bitmap_region(
ALLEGRO_BITMAP *bitmap,
int x,
int y,
int width,
int height,
ALLEGRO_LOCKED_REGION *locked_region,
int flags)
void al_unlock_bitmap(ALLEGRO_BITMAP *bitmap)
Change it to:
ALLEGRO_LOCKED_REGION *
al_lock_bitmap_region(
ALLEGRO_BITMAP *bitmap,
int x,
int y,
int width,
int height,
int flags)
void al_unlock_bitmap(ALLEGRO_LOCKED_REGION *region)
Then add a ->next pointer to ALLEGRO_LOCKED_REGION which contains
additional regions in case the area overlapped several sub bitmaps. The
API change is necessary so they can be allocated and freed again.
Since al_lock_bitmap_region is a very low level operation (you have to
know the exact pixel format) I think this ->next pointer should not be a
big problem.
--
Elias Pschernig <elias@xxxxxxxxxx>