colours changes after graphics mode!
Maikol

Hi all! In my program I read from a config file colours and settings and then I start graphics system. After a deep debug I've noticed colours made before graphics system are changed red and blue! see:

{
...
// for example
colour = makecol24(255,0,0);
...
allegro_init();
set_color_depth(24);
set_gfx_mode(...);
...
al_trace("%d %d %d",getr24(color),getg24(color),getb24(color));
}

and now colour is (0,0,255). I've tried to call set_color_depth() before makecol24() with no success. Do you know why this happens or how to solve it? Don't want to make a function to interchange red and blue, neither use 3 ints instead of 1 to keep rgb and then create colour. Thanks indeed!

Kitty Cat

Allegro doesn't know the color ordering of a graphics mode before the mode is set, so it guesses some defaults. After setting the graphics mode, the color ordering is properly read from the system, which may be different from before setting the mode.

Also, any particular reason for 24-bit? 32-bit is generally faster. :)

Maikol

I use 24 bit because my graphic card isn't able to load 32 bit at high resolutions and because I like using only rgb, no more parameters.

All told I must set graphics and then create colours. Then I'll have to use 3 ints... but maybe one day I'd like to use 32 bits! Pfff okay, I'll manage. Thanks!!

Kikaru

32-bit runs the same as 24-bit, it just allows for fullscreen and takes a little more room. I don't believe allegro uses the last 8 bits at all in 32-bit mode. ;)

Evert
Quote:

I don't believe allegro uses the last 8 bits at all in 32-bit mode.

You've never heard of an alpha channel, have you?

EDIT: also, 24 or 32 bit has nothing to do with being able to run in Windowed mode or not. That said, Allegro will always run in the desktop colourdepth if you're using a window, so setting the colourdepth to something else forces colour conversions at each update.

Thread #588315. Printed from Allegro.cc