int main(int argc, char **argv) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *surf = SDL_LoadBMP("test.bmp");
printf("Format is %s, %dbpp\n",
SDL_GetPixelFormatName(surf->format->format),
surf->format->BitsPerPixel);
SDL_FreeSurface(surf);
SDL_Quit();
return 0;
}
When loading a bitmap saved as A8 R8 G8 B8 in Gimp, the output is paradoxical:
Format is SDL_PIXELFORMAT_RGB888, 32bpp
32 bits per pixel, but only 3 channels?
Examining the surface, it shows Amask = 0, Aloss = 8, as if the alpha channel is being discarded. However when I then load this in OpenGL, I get a garbled image. I have to manually correct the surface format:
Then the image loads correctly (since my texture loader trusts surf->format->format to be correct). So seems like more than just discarding the alpha, but actually generating an incorrect format?