🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #543

Re: 16-bit images : windows game programming for dummies

#543
From: bigbinc
Date: Wed, 04 Aug 1999 00:00
74 lines
4631 bytes
Oh yeah that's a great book.

In order for you to load bitmaps and work with 16/24 bit displays it really
helps to understand them.  It is best for you to look over that section on
video displays and coloring etc, at first I kind of skipped over it them
after wanting to move on to better things I had to go back.  Anyway you
basically need to understand that when working with 16/24/32 bit Direct X
modes (or gdi for that matter) the display is 1. NON-palletized (no palette)
and second thing is that each pixel is a representation of a RGB value which
means that for each display mode there are so many bits needed to hold a red
value a green value and a blue value.  Direct X uses the term masking. 
Red/green/blue mask.  So, a 16 bit image or display will have 5 bits for each
color and the 16th bit set to zero.  and 24 bits will store each color with 8
bits same as 32 bits.  But in 32 bits the extra 8 bits are used for alpha
blending and whatever else you want to use them for.

with that out of the way, when working with direct x you have to make sure
that you are working with the correct mode 8/16/(24)/32 bit mode. Since
direct X takes over your hardware you want to make sure everything is
allright.  Also, you probably need more than a 1MB video card because if you
are working in 32 bit mode at 640x480 then you are pushing the envelope.  The
reason I highlighted 24 is because many cards don't support 24 bit modes.  So
you are pretty much stuck with 32 or 16 bit.  32 bit mode is easier to work
with if you are using 24 bit images.  But most computers don't have the video
cards to work with 32 bit so 16 bit is the way to go.

Problem may arise, because a lot of the graphic programs don't work with 16
bit modes, so you are stuck again.  Now to your question Andre's code
converts 24 bits to 16 bits by dividing by 8 and thats it. The point is that
for 24 bit images for each color you will have 256 shades of that color(red,
green or blue).  and in 16 bit you will have 32. so 256 / 32 = 8 thats all
there is to converting 24 - 16 bit images.

Berlin Brown

In article <7o9sle$41$1@taliesin.netcom.net.uk>,
  "Kumar" <kumar@netcomuk.co.uk> wrote:
> Hello,
>
> The best person to help me out with this would be someone who has read
> Windows Game Programming for dummies I guess; but I would appreciate a
> response from anyone who thinks they could help me out!
>
> I have finished the book Windows Game Programming for Dummies and am now
> embarking on my first project.  However, I have encountered a problem when
> attempting to display a 16/24 bit background on to the screen.
> I am using the same code as I use to display an 8bit bitmap (but without the
> setpalette() function).
>
> When I try to display an 8 bit background with 8 bit sprites on top of it I
> have no problems and can write a workable basic game.
>
> But when I try to display a 16 bit background in exactly the same manner,
> the image is displayed incorrectly and looks like a mess.
> I think it has something to do with the lpitch but I can't see why it would
> work with the 8bit file but not the 16bit file.
>
> I've tried for 2 days to correct this but with no success - any advice
> anyone could offer would be most graciously received.
>
>  I am using 640X480X8 and 640X480X16 images for the backgrounds.
>
> Regards,
> Kumar Naib
>
>

--
"...yes darling, computers are people too..."
http://www.geocities.com/southbeach/lights/5679


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID: <7oa59o$t6s$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7o9sle$41$1@taliesin.netcom.net.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10e433,7271cc3f603df36
X-Google-Attributes: gid10e433,public
X-Google-Thread: 11431d,7271cc3f603df36
X-Google-Attributes: gid11431d,public
X-Google-Thread: 114592,7271cc3f603df36
X-Google-Attributes: gid114592,public
X-Google-Thread: fdc2a,7271cc3f603df36
X-Google-Attributes: gidfdc2a,public
From: bigbinc <bigbinc@hotmail.com>
Subject: Re: 16-bit images : windows game programming for dummies
Date: 1999/08/04
Message-ID: <7oa59o$t6s$1@nnrp1.deja.com>
X-Deja-AN: 508879979
References: <7o9sle$41$1@taliesin.netcom.net.uk>
X-Http-Proxy: 1.0 x43.deja.com:80 (Squid/1.1.22) for client 208.246.156.41
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Wed Aug 04 19:46:04 1999 GMT
X-MyDeja-Info: XMYDJUIDbigbinc
Newsgroups: alt.comp.lang.learn.c-c++,alt.comp.shareware.programmer,borland.public.cppbuilder.graphics,comp.graphics.algorithms
X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.02; Update a; Windows 95)