Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Large bitmap: al_load_bitmap() returns NULL

This thread is locked; no one can reply to it. rss feed Print
Large bitmap: al_load_bitmap() returns NULL
niks
Member #5,265
November 2004

Hi everyone,

Firstly, kudos to the developers for pushing out A5. A friend and I have been working with A4 for a while and now I'm in the process of transitioning our code to the new API.

I'm having trouble loading a large bitmap. Details:
What: A tilemap exported from Mappy level editor [1]
Type: PNG image, 5136 x 16, 8-bit/color RGB, non-interlaced
Issue: al_load_bitmap() returns NULL

In my code, I have enabled the image add-on like so, before loading the bitmap:
if(false == (status=al_init_image_addon())) {
// write to log & exit
}

It works successfully with smaller bitmaps, such as these:
Type: PNG image, 96 x 32, 8-bit/color RGBA, non-interlaced
Type: PC bitmap, Windows 3.x format, 816 x 16 x 8

Now this was code that was working in A4, so I'm wondering if anyone else has had problems loading large dimension bitmaps using the image add-on on A5?

Since I'm generating the tilemaps from Mappy level editor, I can force it to have almost-equal width and height during export, which will make my program work for now.

However, this is not a permanent solution since it will not work for the final level design in which the resulting bitmap will be inevitably large in dimension.

Any thoughts? and/or recommendations?

Thanks,
Niks

gnolam
Member #2,030
March 2002
avatar

Make sure you're loading it as a memory bitmap with al_set_new_bitmap_flags(). Otherwise, it has to be uploaded to your graphics card as a texture, and there's a good chance your card/drivers won't support such a wide texture.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

niks
Member #5,265
November 2004

Thanks, gnolam. For the quick and concise reply. I did read about this in the manual here: al_set_new_display_option() but I didn't know you could set it on a per-bitmap level.

Quote:

ALLEGRO_MAX_BITMAP_SIZE: When queried this returns the maximum size (width as well
as height) a bitmap can have for this display. Calls to al_create_bitmap or
al_load_bitmap for bitmaps larger than this size will fail. It does not apply to
memory bitmaps which always can have arbitrary size (but are slow for drawing).

Awesome! ;D

Go to: