Advertisement Jump to content


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

Biased turkey

Newbie confused with SDL Palette

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

First, I''m running SDL but ( vomit on the keyboard ) the Windows version. I ask my question on the Linux board because I think that''s the board the most knowledgeable about SDL. I was able to have a simple program ploting a pixel on a palettized ( 8bpp )surface. AsI understant I have to "attach" the 256 SDL_Color array to the surface and I did that using the SDL_SetColors ( that worked ) . Now I tried using the SDL_SetPalette function and it works too. Could someone please be kind enougf what''s the exact difference between the 2 functions and in what specific case I shoild use one or the other Thanks in advance for any tip, info or opinion P.S. my next goal will be to run the SDL Linux version

Share this post

Link to post
Share on other sites
Well, i don''t know the answer, but SDLDoc does!

To quote, "Palettized (8-bit) screen surfaces with the SDL_HWPALETTE flag have two palettes, a logical palette that is used for mapping blits to/from the surface and a physical palette (that determines how the hardware will map the colors to the display). SDL_SetColors modifies both palettes (if present), and is equivalent to calling SDL_SetPalette with the flags set to (SDL_LOGPAL | SDL_PHYSPAL)."
Very useful website.

By the way, if sdldoc doesn''t help, or if you have other questions, you can always join us on irc at on #sdl.


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!