Displaying bitmap with alpha
mentalDisorder

I'm trying to draw bitmap with alpha channel.
If there is no alpha channel everything looks good, but once I add some alpha to the image gray rectangle is displayed :(
Should I set some blender flags or wha ? If so, which ?

Trent Gamblin

Show some code, please.

mentalDisorder

ALLEGRO_FILE *file = al_fopen("gfx/something.bmp", "r");
al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA);
bitmap = al_load_bitmap_f(file, ".bmp");

Drawing:
al_draw_bitmap(bitmap, 10, 10, 0);

Trent Gamblin

Allegro can't load alpha from .bmps. Use .png.

Matthew Leverton
ALLEGRO_FILE *file = al_fopen("gfx/something.bmp", "r");
bitmap = al_load_bitmap_f(file, ".bmp");
al_fclose(file);

could be written as:

bitmap = al_load_bitmap("gfx/something.bmp");

mentalDisorder

oh yee I know it can be done in a shorter way, I had some issues with loading .bmps and I tried different solutions :)

By the way, allegro5 seems not to cope with .tga files, manual says it should ?

Trent Gamblin

It probably doesn't support every type of TGA, but it does work.

Thread #608239. Printed from Allegro.cc