Problem With Loading Images (Allegro 4.4)


el_pango

Member
Joined
May 31, 2006
Messages
145
Location
California
Hi all,

I'm encountering a problem with loading images in Allegro. In my code, I'm doing the following:

Code:
/******************************************************************************/

BITMAP *sprite;
BITMAP *layer1;
BITMAP *layer2;
BITMAP *layer3;

BITMAP *dbuf;

/******************************************************************************/

void load_images(void)
{
	sprite = load_bitmap("./sprite.bmp",NULL);
	layer1 = load_bitmap("./layer1.bmp",NULL);
	layer2 = load_bitmap("./layer2.bmp",NULL);
	layer3 = load_bitmap("./layer3.bmp",NULL);
}

and later:

Code:
void draw_background(void)
{
	blit(layer3,dbuf,0,0,0,0,layer3->w,layer3->h);
	
	draw_sprite(dbuf,layer2,scroll2,100); draw_sprite(dbuf,layer2,scroll2 - 399,100);
	draw_sprite(dbuf,layer1,scroll1,100); draw_sprite(dbuf,layer1,scroll1 - 399,100);
}

...at which point, the application will signal 11 because the BITMAPs are null, suggesting that the library is having trouble loading them.

I've verified that the files in question are valid .bmp images, that the same program works as expected in both Win XP and X86 Linux, and that, on the target device, the user running the application has read and writer permissions for them, and that the application is capable of displaying the sample images from the "example" directory if I copy them over and rename them (along with changing the file extension in the code to match). I've also checked whether I can successfully open a file for reading from the same directory, and that seemed to work fine.

Unfortunately, it doesn't look like errno is being set, so I don't have any other details about the problem.

Is anyone else encountering this? How do I work around it?
 
el_pango said:
Hi all,

I'm encountering a problem with loading images in Allegro. In my code, I'm doing the following:

Code:
/******************************************************************************/
// blah blah blah

...at which point, blah blah blah.

Is anyone else encountering this? How do I work around it?

Solved - this was my fault, in fact. I misunderstood the implications of calling configure with --disable-color24, thereby causing my compiled library to not be able to load truecolour images. I re-ran configure without that, re-'make'ed, and re-'make install'ed, and it works quite nicely now.

Own goal on my part.
 
Last edited by a moderator:
Back
Top