Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » failure without bitmap

This thread is locked; no one can reply to it. rss feed Print
failure without bitmap
Vieira
Member #16,926
December 2018

Hello, I am trying to insert an image into my game and gives the following error:

Assertion failed: bitmap, file d:/Libraries\build\allegro\src\allegro-git\src\bitmap_draw.c, line 138

Code:
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_image.h>
int main(void)
{
ALLEGRO_DISPLAY *janela = NULL;

ALLEGRO_BITMAP *imagem;

al_init();

al_init_image_addon();

janela = al_create_display(1080, 720);

imagem = al_load_bitmap("capturar.jpg");

al_draw_bitmap(imagem, 0, 0, 0);

al_flip_display();

al_rest(5400.0);

al_destroy_display(janela);

al_destroy_display(imagem);

return 0;
}

I wanted to know how to solve the problem, because it gave in more than one code ???

dthompson
Member #5,749
April 2005
avatar

Hi Vieira - welcome to the forums.

It seems your bitmap pointer imagem is null. This means al_load_bitmap was unable to load the file you specified, "capturar.jpg".

  • Are you certain the filename is correct?

  • Are you using the right case? (eg. is it actually named capturar.JPG?)

  • Are you running the program from the same directory as the location of the image?

  • Can you successfully open the file using the C standard library (using fopen etc)?

For future reference, please post questions like this in the programming questions subforum; "Allegro Development" is for discussion of the development of the Allegro library (rather than with it). :)

______________________________________________________
Website | Where my website used to be
This isn't a game!

Go to: