Advertisement Jump to content


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

ji yan

Palette in D3D??

This topic is 6120 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

Does anyone know how to specify a pallete for a real-time rendering texture I am working on?

Share this post

Link to post
Share on other sites
It''s in the SDK documentation!!:



DirectX 8.1 (C++) ->
DirectX Graphics ->
Programmers Guide ->
Using Direct3D ->
Textures ->
Basic Texturing Concepts ->
Texture Palettes

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
I turned to the doc as you directed, and tried to set up my own pallete. Here is the code I used:

PALETTEENTRY m_mypal[256];
int index = 0;
for(index; index < 256; index++)
m_mypal[index].peRed = 100;
m_mypal[index].peGreen = 100;
m_mypal[index].peBlue = 100;
m_mypal[index].peFlags = 1;

if(FAILED(m_pd3dDevice->SetPaletteEntries(16381 ,m_mypal)))
return E_FAIL;

I dunno why the call, m_pd3dDevice->SetPaletteEntries(16381 ,m_mypal) always resulted in a value of E_FAIL. I can''t find anything wrong with this code. And, I have enabled the alpha capability as exactly what doc instructs.

Like this: m_d3dCaps.TextureCaps = D3DPTEXTURECAPS_ALPHAPALETTE;

Can anyone tell me why this code failed???

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!