delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/04/21:49:04

From: varobert AT colba DOT net
Message-Id: <3.0.32.19990804101017.007c9140@mail.colba.net>
X-Sender: varobert AT mail DOT colba DOT net
X-Mailer: Windows Eudora Pro Version 3.0 (32)
Date: Wed, 04 Aug 1999 10:10:19 -0400
To: djgpp AT delorie DOT com
Subject: Re: beginner allegro question
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

At 01:41 AM 8/4/99 +0200, you wrote:
>1 ) Can anyone tell me more on how to display
>my_nice_povray_rendered_targa_file(tm) in *true color* ?
>
>I already have this :
>
>...
>  BITMAP *thing;
>...

Use set_color_depth() here to set the color depth (8, 15, 16, 24, 32 bpp)

>  if (set_gfx_mode(GFX_VESA2L, 640, 480, 0, 0) != 0) {
>      printf ("uh-oh");
>      exit(1);
>   }
>
>  thing = load_tga("thing.tga",pal);
>  set_palette(pal);
>  draw_sprite(screen, board, 0, 0);

Is "board" defined ? shouldn't it be "thing" ?

>
>  readkey();
>...
>...
>
>but that looks rather 8bbp-ish.

Change the color depth...

>
>And yet another silly question  :  If I put this tga-fila in a data-file, I
>do :
>  thing = (RLE_SPRITE *)data[THING_TGA].dat;
>... but I don't know how to get the palette right.

You'll need to extract the palette from the image from within the grabber,
so you have a palette and a bitmap object.
You can then use something like this:

pal = (RGB*)data[THING_PAL].dat;
set_palette(pal);

thing = (RPG_SPRITE*)data[THING_TGA].dat;



- GodOfWar
In the world of computers, things tend to become faster, smaller and
cheaper with time. Does that mean that Microsoft invented time travel ?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019