Mail Archives: djgpp/2000/08/25/18:48:21
On Wed, 23 Aug 2000 23:02:50 -0700 (PDT), Chris Amos
<homie_dont_play_dat AT yahoo DOT com> wrote:
>> > set_gfx_mode(GFX_AUTODETECT,640, 480,0,0);
>> > set_color_depth(16);
>> > bmp = load_bitmap("Tile1.bmp", pal);
>> > draw_sprite(screen, bmp, 0, 0);
>>
>> You get weird colored garbage because you're not drawing with the
>> right palette. Also, if you're putting multiple images on one
>> 256-color screen, make sure they have the same palette.
>
>What are you talking about? There are no Palettes in 16 bit mode.
But you're not running in 16-bit mode. Because you set the color
depth after you set the graphics mode, you're running in the default
8-bit mode.
>The pics are 24 bit, so shouldnt the Allegro routines
>automaticly convert the pic to 16 bits per pixel?
It's automatically converting to 8 bits per pixel in a "332" (8 levels
red, 8 levels green, 4 levels blue) palette. Because you're in 8-bit
mode and have not set the palette to the 332 palette returned by
load_bitmap(), you're getting funky colors.
To solve the problem, move set_color_depth() above set_gfx_mode. And
make sure the output from set_gfx_mode() is non-negative; if it's
negative, Allegro couldn't find a suitable graphics mode, the display
is still in text mode, and any attempts to draw to `screen' will cause
a SIGSEGV.
--
MS (n) 1. A debilitating and surprisingly widespread
affliction that renders the sufferer barely able to
perform the simplest task. 2. A disease, multiple
sclerosis (see).
This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses. http://www.mcafee.com/
- Raw text -