Images look completely wrong - color depth problem?
Michael Faerber

I'm loading and drawing an image with this code:

// setting up gfx mode
set_colov_conv(COLORCONV_TOTAL);

// ...

banana = load_bitmap("media/banana.pcx", NULL);

// ...

stretch_sprite(buffer, banana, 0, 0, SCREEN_W, SCREEN_H);

However, when it shows the image, all colors are plain wrong. Any idea?

Matthew Leverton

You are setting color depth, setting the graphics mode, and then loading bitmaps, right?

Michael Faerber

No - first the graphics mode, then the color depth, then the color conversion, then the bitmaps loading.

Richard Phipps

Do it like this:

     set_color_depth(32);
      if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) {
         abort_on_error("Couldn't set a 32 bit color resolution");
      }

Kauhiz

You should do it in the order ML said -- color depth first.

edit: beaten by Phipps

Michael Faerber

Thanks a lot!

I've tried that before, but with set_color_depth(bitmap_color_depth(screen)), which works when called AFTER the gfx initialisation, but crashes when called BEFORE the gfx initialisation.

[EDIT]
I realize now that that was completely stupid.

Richard Phipps

:)

BAF

desktop_color_depth() gets the desktop's depth.

Thread #586867. Printed from Allegro.cc