Archived

This topic is now archived and is closed to further replies.

CondorWitte

I need some help with DirectDraw Palettes...?

Recommended Posts

CondorWitte    122
Hello all. I use the following (test)code to set the palette of the primary surface:
        
//---------------------------------


	PALETTEENTRY pe[256];

	for (int i=0;i<256;i++)
	{
		pe .peRed=i;
		pe<i>.peGreen=0;
		pe[i].peBlue=0;
		pe[i].peFlags=PC_NOCOLLAPSE;
	}

	LPDIRECTDRAWPALETTE pal;

	directdraw2->CreatePalette(DDPCAPS_8BIT|DDPCAPS_INITIALIZE|DDPCAPS_ALLOW256,pe,&pal,NULL);

	if (pal)
	{
		if (primary) primary->SetPalette(pal);
		if (backbuffer) backbuffer->SetPalette(pal);
	}

//---------------------------------------

        
Next, I blit a bitmap an offscreen-surface(video/system-mem) to the backbuffer and I flip. (fullscreen, 800x600x8, 1 backbuffer) The problem is that I still only see 2 shades of red (100% and 0%), instead of the 256 I expected... All bitmap images I am going to use, will be 256-color using the Windows system palette. Should I set the palette of the source-surfaces as well...??? Any help would be very much appreciated! Greetings. Edited by - WitchLord on 7/19/00 9:15:20 AM

Share this post


Link to post
Share on other sites
CondorWitte    122
The problem is solved already.

Although the MSGboard didn''t copy the code correctly, there was no mistake in it.

The problem was in the call to LoadImage(). To load a bitmap as a DIB, the LR_CREATEDIBSECTION flag should be set....

Sorry for bothering.

Share this post


Link to post
Share on other sites