![]() |
|
An example of using load_bitmap |
ibse12
Member #22,686
March 2022
|
I downloaded allegro-4.4.3.1 and I am trying to load bmp file via load_bitmap(): 1#include <allegro.h>
2#include <stdio.h>
3int main(void)
4{
5 BITMAP* b = load_bitmap("/home/ibse/alexlogo.bmp", NULL);
6 return 0;
7}
but get Segmentation fault error. The backtrace is 1Program terminated with signal SIGSEGV, Segmentation fault.
2#0 0x00007f6b7472c204 in create_bitmap_ex (color_depth=8, width=128, height=128) at /home/ibse/Downloads/allegro-4.4.3.1/src/graphics.c:1042
31042 if (system_driver->create_bitmap)
4(gdb) bt
5#0 0x00007f6b7472c204 in create_bitmap_ex (color_depth=8, width=128, height=128) at /home/ibse/Downloads/allegro-4.4.3.1/src/graphics.c:1042
6#1 0x00007f6b7470a97b in load_bmp_pf (f=f@entry=0x55da0b8775a0, pal=0x7ffdb59aa5e0, pal@entry=0x0) at /home/ibse/Downloads/allegro-4.4.3.1/src/bmp.c:699
7#2 0x00007f6b7470b58d in load_bmp (filename=<optimized out>, pal=0x0) at /home/ibse/Downloads/allegro-4.4.3.1/src/bmp.c:611
8#3 0x00007f6b7474e241 in load_bitmap (filename=0x55da0b373bc2 "/home/ibse/alexlogo.bmp", pal=0x0) at /home/ibse/Downloads/allegro-4.4.3.1/src/readbmp.c:81
9#4 0x000055da0b365e96 in main () at /home/ibse/Downloads/allegro-4.4.3.1/demos/skater/source/skater.c:5
Could anyone provide me with an example of how to use this routine correctly? |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
system_driver is NULL, causing the SEGFAULT. You didn't call allegro_init. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Mark Oates
Member #1,146
March 2001
![]() |
You need to start with use allegro_init. If you were using Allegro 5, you would use al_init. An,d because you are loading a PNG image you would need to al_init_image_addon(). -- |
Chris Katko
Member #1,881
January 2002
![]() |
Please stop using Allegro 4. It was made for DOS games. Like 20 years ago. In 99.99999% of all cases, you can "emulate" the feel of DOS in a proper Windows/Linux/Mac application. -----sig: |
|