-//NOTE: Seems the byte order here *is* important! (Perhaps only for 32 BPP?)
- texture = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
+ //NOTE: Seems the byte order here *is* important! (Perhaps only for 32 BPP?)
+ //
+ // NOTE : Nope! Not any more. We can now producte textures based upon 16, 24 or 32 bpp.
+ switch ( texturebpp )
+ {
+ case 16:
+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+
+// rmask = 0xff000000;
+// gmask = 0x00ff0000;
+// bmask = 0x0000ff00;
+// amask = 0x00000000;
+
+ rmask = 0x0000;
+ gmask = 0x0000;
+ bmask = 0x0000;
+ amask = 0x0000;
+
+ #else
+
+// rmask = 0x000000ff;
+// gmask = 0x0000ff00;
+// bmask = 0x00ff0000;
+// amask = 0x00000000;
+
+ rmask = 0x0000;
+ gmask = 0x0000;
+ bmask = 0x0000;
+ amask = 0x0000;
+
+ #endif
+ break;
+ case 24:
+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ rmask = 0x00ff0000;
+ gmask = 0x0000ff00;
+ bmask = 0x000000ff;
+ amask = 0x00000000;
+ #else
+ rmask = 0x000000ff;
+ gmask = 0x0000ff00;
+ bmask = 0x00ff0000;
+ amask = 0x00000000;
+ #endif
+ break;
+ case 32:
+ default:
+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ rmask = 0xff000000;
+ gmask = 0x00ff0000;
+ bmask = 0x0000ff00;
+ amask = 0x000000ff;
+ #else
+ rmask = 0x000000ff;
+ gmask = 0x0000ff00;
+ bmask = 0x00ff0000;
+ amask = 0xff000000;
+ #endif
+ break;
+ }
+
+ // create texture surface
+ texture = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, texturebpp, rmask, gmask, bmask, amask);
+/*
+ #if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
+ #else
+ 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
+ #endif
+*/
+
+
+/*
+ texture = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,