• Advertisement

Archived

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

I need some help with DirectDraw Palettes...?

This topic is 6393 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
That''s weird!

I didn''t make a mistake: the MSGboard did.

I definetely typed an i in brackets, but I can''t see it in the post.

Share this post


Link to post
Share on other sites
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

  • Advertisement