I'm trying to figure out why calling SDL_GetWindowPixelFormat is returning SDL_PIXELFORMAT_RGB888, even though I'm creating the window with the flag "SDL_WINDOW_FULLSCREEN_DESKTOP", and my desktop uses 32-bit color.
Perhaps I'm misunderstanding what this flag means. I'm running my program on a Windows 7 machine, and I checked the display color-depth using Control Panel -> Display -> Adjust Resolution -> Advanced Settings -> Monitor (which displays "50 Hz, True Color 32-bit".)
I'm coding using SDL2 (version 2.0.6). I was expecting this call to return SDL_PIXELFORMAT_RGB8888 or some other 32-bit format. Any help appreciated on clarifying this. My code is below.
#include "SDL2/SDL.h"
#include <stdio.h>
SDL_Window* window;
int main(int argc, char* args[]) {
SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow("TUTOR",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);
Uint32 global_pixel_format = SDL_GetWindowPixelFormat(window);
const char* temp = SDL_GetPixelFormatName(global_pixel_format);
printf(" SDL_Window created with pixel format %s\n", temp);
SDL_Quit();
return 0;
}