Some questions about 8-bit mode...

Started by
6 comments, last by GameDev.net 24 years, 6 months ago
Don't use pallete entrys 0 and 255, those are reserved.

--TheGoop

Advertisement
I used the allow256 (or whatever the exact syntax is) flag...so shouldn't I be able to use these?
The first 10 en last 10 colors are reserved for windows....that's what I know.

And further, it's VB so I don't know

------------------
Dance with me......

As long as you define the PC_NOCOLLAPSE inside you palette entries and use DDPCAPS_ALLOW256, you have the full range to use with no problem.

Try using this method to create the palette:

/*
lpdd
= DirectDraw Interface
lpddpal
= DirectDraw Palette Interface
lpddsprimary
= DirectDraw Primary Buffer Interface
*/

PALETTEENTRY pal[256];

memset(pal, 0, sizeof(PALETTEENTRY) * 256);
for(i=0;i<256;i++) {
pal.peRed = i;<BR> pal.peGreen = i;<BR> pal.peBlue = i;<BR> pal.peFlags = PC_NOCOLLAPSE;<BR>}<P>lpdd->CreatePalette(DDPCAPS_8BIT |<BR> DDPCAPS_INITIALIZE | DDPCAPS_ALLOW256,<BR> pal, &lpddpal, NULL);<P>lpddsprimary->SetPalette(lpddpal);<P>Jim<BR>

__So, you're trying to map a different value of gray to each of the 256 colors. I think you might have a samll problem.
__When running in ture 8-bit color there are only 262,144 colors to work with (an 18-bit pallette.) If I'm correct, you'll see banding in gradients.
__Does anyone know more about how this works in Windows?

[This message has been edited by SonicSilcion (edited October 06, 1999).]

If you use the windows palette manager, then it would try to dither it or something to make it look right.

In his case, he couldn't get a full white color, but rather a grayish one when using palette register 255 that he setup previously to a white value.

The thing that I don't know is, with DOS, you have to scale the 8bit value down to 6bit, but I guess DirectX does that automatically when you try to set an 8bit value.

Jim

I've been playing around with 8-bit mode, and I've got a few questions. First off let me just say that I was playing with a palette that was made by just looping from 0 to 255 and assigning the 0-255 value to each red, green, and blue value. So I basically made a grey-scale palette. Also, I'm using VB 5.0 if that molds your answer any...

1) When I'm calling a function that requires a color value, do I give it a 0-255 value representing an entry in my palette? I did this and it seemed to work, but I just want to make sure I'm not doing it wrong.

2) When I set the backbuffer's forecolor property, I get mixed results using the method in number 1. When I set the color to 0 (black in my palette) it will have black text, yet when i use 255 (white in my palette) I get a grayish color. Any ideas why this happens?

3) How could I go about using a bitmap that has 256 total pixels, each pixel having a particular color i want in my palette, and use that to make a palette in DirectX?

When I do a bltcolorfill, it look fine (white), but when I try to changed the font color to 255...it is still a greyish color. Are fonts restricted in their color? Or should I ideally be able to set it as any color?

Oh, btw, setting the font to 0 (black) will work just great...

This topic is closed to new replies.

Advertisement