The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Indexed color still around for SDL2?
Jorhlok


Joined: 11 May 2013
Posts: 6
I was trying to play around with indexed color with SDL2. I'm running Linux Mint 14 64 bit and I compiled SDL2 and SDL2_image myself and installed them. I can link to them correctly and everything.


I haven't done anything but RGB color in SDL 1.2. Poking around the SDL2 wiki, there seems to be indexed color stuff in there, for instance "SDL_PIXELFORMAT_INDEX8" and some palette functions for SDL_Surface. There doesn't seem to be anything dealing with palettes for SDL_Texture objects.


I know the entire world has since moved to a true color world including Allegro which I've also played with. So are palettes and indexed color even a real option in SDL2?


If so, I don't know how to begin. Creating a window and renderer don't appear to give me a bits per pixel option. Would it be essentially the same if I looked for a SDL 1.2 guide on it?
Indexed color still around for SDL2?
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
SDL 2.0 mostly just has support for palettes in SDL_Surface, but not textures.  It will automatically convert paletted surfaces to truecolor when uploading them to textures.

There are some neat tricks you can do with single channel textures and shaders, but they're outside the scope of the SDL 2D API, and you should use OpenGL directly for those.



On Fri, May 10, 2013 at 6:50 PM, Joshua Brown wrote:
Quote:
I was trying to play around with indexed color with SDL2. I'm running Linux Mint 14 64 bit and I compiled SDL2 and SDL2_image myself and installed them. I can link to them correctly and everything.


I haven't done anything but RGB color in SDL 1.2. Poking around the SDL2 wiki, there seems to be indexed color stuff in there, for instance "SDL_PIXELFORMAT_INDEX8" and some palette functions for SDL_Surface. There doesn't seem to be anything dealing with palettes for SDL_Texture objects.


I know the entire world has since moved to a true color world including Allegro which I've also played with. So are palettes and indexed color even a real option in SDL2?


If so, I don't know how to begin. Creating a window and renderer don't appear to give me a bits per pixel option. Would it be essentially the same if I looked for a SDL 1.2 guide on it?





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org