How to set fewer than 32 bpp for SDL window?

184 views Asked by At

I've been trying to write a program that uses SDL for drawing, but I've been unable to find any way to set 15-bits per pixel (2 bytes per pixel) rather than the 4-byte RGBA that it sets by default. I get a segfault whenever I try to blit from a 15bpp back buffer (an array of shorts) to the screen surface. The window was defined as

window = SDL_CreateWindow("UFC32 Emulator v0.2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);

Meanwhile, I tried to do a copy this way.

screenSurface = SDL_GetWindowSurface(window);
SDL_BlitSurface(backBuffer, NULL, screenSurface, NULL);

What I'm looking for is a substitute for my window creation code where I can set the color depth.

0

There are 0 answers