[SDL] SDL_MapRGB on big endian architectures

Torsten Giebl wizard at syntheticsw.com
Tue Apr 22 03:59:55 PDT 2008


Hello !


> I am doing some experiments with SDL on the Playstation 3. PS3 uses   
> the Cell processor which consists of a PPC core and some additional   
> stuff. So it usess big endian byte order.
> When I do a SDL_MapRGB(screen->format, 0, 0, 255) I end up with a   
> red color. Is this intended (do I have to do swapping myself)?
> Color masks seem to be correct (e.g. 0xFF0000 for red).
> used SDL version is 1.2.10

SDL 1.2.10 is really old, please
try the latest SDL version from the website ?

> Small test program that I used to test this:
>
> #include <SDL/SDL.h>
> #include <stdio.h>
>
> int main() {
>         SDL_Init(SDL_INIT_VIDEO);
>         atexit(SDL_Quit);
>         SDL_Surface* screen = SDL_SetVideoMode(800, 600, 32,   
> SDL_SWSURFACE | SDL_DOUBLEBUF);
>         SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 255));
>         SDL_Flip(screen);
>         getchar();
> }

Do you run SDL under a PS3 Linux distro ?


CU



More information about the SDL mailing list