delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/24/20:31:54

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Please Help: Allegro 3.0 beta
Date: Mon, 24 Nov 1997 23:47:42 +0000
Organization: None
Distribution: world
Message-ID: <bUkFhOAeIhe0EwLy@talula.demon.co.uk>
References: <347A03FB DOT 4A0B AT voyageur DOT ca>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 42
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

J.E. writes:
>1. AFAIK, the docs say that true color images don't use palettes, but
>the RGB values are stored directly in the pixels (video mem, I guess). 
>So how many R, G, or B values are there (63? 255?)?  

That depends on the color depth. In 24 or 32 bit modes there are 8 bits
each of red, green, and blue, so you have 256 levels of each color
component (the 32 bit modes are the same as 24 bits, but with an added
pad byte to keep things aligned and make them go faster). In a 15 bit
mode there are 5 bits of each color (32 shades), and the 16 bit modes
use a 5.6.5 layout (5 bits or 32 shades of red and blue and 6 bits or 64
shades of green).


>Also, how to I specify a color to use during drawing primitives (like 
>putpixel) if there is no palette?

Use the makecol() function. See ex29.c...

>2. Now for my next question:  How do I create a reasonably fast double
>buffering system in true color (24-bit)?  I tried using the usual 
>method (scan under sprites, draw to buffer, blit buffer to screen, 
>erase sprites), but it's *extremely* slow on my Cyrix 5x86 75mhz 

Get a faster PC :-) A 640x480x24 image is nearly a megabyte of data:
that is a huge amount to be copying on every frame! Using a 15 or 16 bit
mode will help (those are usually much faster to draw than the 24 bit
resolutions as well, due to better pixel alignment), and if possible you
should try to use some kind of double buffer system and only blit the
regions that have changed from one frame to the next...

>And now my final question:  How do I use a transparent color to draw 
>24-bit sprites? 

Allegro uses bright magenta (maximum red and blue, zero green) as a
special marker color, in exactly the same way as color #0 in the 256
color modes.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


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