AllegroGL: How to make textures from datafile-bitmaps?
maxx.t

I have the following question: Why does

texture_id = allegro_gl_make_texture ((BITMAP *)dat[SOME_BITMAP].dat);

results in a very dark (almost black) texture whereas

bmp = load_bitmap("some_bitmap.pcx",pal);
texture_id = allegro_gl_make_texture (bmp);

works fine although dat[SOME_BITMAP] is the grabbed file "some_bitmap.pcx".
What am i missing?

gnolam

Have you set color depth, graphics mode, color conversion etc. before loading the datafile?

maxx.t

I loaded the datafile before setting up the graphic mode.

Loading the datafile after the graphics setup results in the right intensitiy
of the texture. However, now the wrong palette is used for drawing. This holds for the texture and also if I use the loaded bitmap for blitting in allegro mode.

Changing the color depth to the one of the bitmap (8 bit) or using set_palette()
with the related palette of the bitmap does not help.

Neil Walker

why not just save the image as an rgb rather than paletted image?

gnolam

Due to the way 8-bit images are stored in datafiles, you'll have to load and set the proper palette before loading the datafile. So:

  1. Set color depth and graphics mode.

  2. Load the proper palette with load_datafile_object() and set it.

</li>

maxx.t

Thank you very much!
Both solutions are working fine.

Thread #589511. Printed from Allegro.cc