|
Author Topic:   FrogSkin
DarkFrog
Member
posted October 31, 1999 01:32 AM            
Well, I sent you (Seumas), an email question regarding an explanation of the BackBuffer true color format, and everything else related to being able to use 16 and 24 bit color. I'm also posting this here because I need the answer soon, and other people might, and hopefully have suggestions on how to handle it efficiently.
btw, anyone who wants versions or a final copy of the open-source game library I'm working called FrogSkin on just post their e-mail, and I'll try my best to respond (i'ts currently just primative 256 graphics via BackBuffer and CDIB, fully functioning input (including toggles ), and a basic sound system by Adre LaMothe)

-Austin Spafford (DarkFrog)

IP:

Kaeto
Member
posted November 06, 1999 11:52 AM            
You really should check out SEAL. It is one heck of a sound system for free!

IP:

LDA Seumas
unregistered
posted November 06, 1999 04:02 PM           
Oops, sorry about the delay...

Once you set your BackBuffer mode, your global TrueColorFormat object should be configured for the new true color mode you just set. You can then use the member functions in the TCF to either get and set true color pixels directly, or to create 8-bit to 16/24/32bit lookup tables for blitting 8-bit images directly onto the true color surface. You can also access the color masks and shift members (read only, please) if you want all the info on how to directly tweak pixels in the buffer.

The MakeLookup() members of TCF tace a PALETTEENTRY based color palette and write a WORD or DWORD based lookup table for that palette and the current true color mode. Use a WORD table for 16-bit and a DWORD table for 32-bit. To blit an 8-bit image onto the surface, just use the 8-bit pixel values to lookup into the lookup table, and splat that WORD or DWORD down onto the back buffer.

Note that you'll have to re-create your lookup tables if the screen mode changes, e.g. to windowed mode and back. FYI, DX-Ball 2 stores all its art as 8-bit originally, and then converts to 16-bit whenever the screen mode changes, and blits with the cached 16-bit versions.

------------------
-- Seumas McNally, Lead Programmer, Longbow Digital Arts

IP:

DarkFrog
Member
posted November 07, 1999 01:46 PM            
Thanks for the help, but what I need is a description of what all the masks and what not do that are in the format, and details on how I set up and use the colors (In other words, how to write an RGB() function, as well as what I need to do to read each of the three components, see what I mean?)

IP:

LDA Seumas
unregistered
posted November 07, 1999 03:37 PM           
From the BackBuffer.h file:

unsigned int BPP; //Bits per pixel.
unsigned int RedMask; //Bit-mask for red component.
unsigned int RedMaskLen; //Bit length of red component.
unsigned int RedMaskOff; //Bits to shift red component up.
unsigned int RedQuant; //Bits to shift 8-bit value down to get proper length.

Which should be explanatory. FooQuant is just (8 - FooMaskLen), which is how many bits to chop off the right side of an 8-bit color component to make it the correct length for the true color pixel (only relevant for 16-bit really).

TrueColorFormat.PackColor() is your RGB() function. It takes a Red, a Green, and a Blue, and returns a packed pixel in the current true color format, ready to be splatted into the back buffer as a WORD or DWORD. UnpackColor() is the inverse, which takes a packed pixel and returns the Red, Green, and Blue components.

Does that make sense?

------------------
-- Seumas McNally, Lead Programmer, Longbow Digital Arts

IP:

DarkFrog
Member
posted November 07, 1999 04:48 PM            
Yes, it does, thanks.
(but I'm still foggy on bitwise operators, and such, so even though I did take a look at the header, along with the comments, I still don't get what the bitmask is, but I guess that is alright as long as I can get by with the pack and unpack)

IP:

DarkFrog
Member
posted November 07, 1999 10:59 PM            
Well, after a couple of hours reworking my test program, I have not been able to get even 16 bit color working, would it at all be possible to get an example .cpp for how to get 16, or hopefully 24 bit color working???
(basically I learned 8-bit from the backbuffer demo, but since there is not true color version w/ it, I'm lost.)

IP: