[Fix] Screenshots were saved as RGBA. Bad idea.
This commit is contained in:
parent
9773d9b19a
commit
7034b2369c
@ -135,14 +135,14 @@ static uint8_t* SDL_MapTrans(SDL_Surface* s) {
|
||||
// Take a screenshot.
|
||||
void gl_screenshot(const char* filename) {
|
||||
SDL_Surface* screen = SDL_GetVideoSurface();
|
||||
unsigned rowbytes = screen->w * 4;
|
||||
unsigned rowbytes = screen->w * 3;
|
||||
unsigned char screenbuf[screen->h][rowbytes], *rows[screen->h];
|
||||
int i;
|
||||
|
||||
glReadPixels(0, 0, screen->w, screen->h, GL_RGBA, GL_UNSIGNED_BYTE, screenbuf);
|
||||
glReadPixels(0, 0, screen->w, screen->h, GL_RGB, GL_UNSIGNED_BYTE, screenbuf);
|
||||
|
||||
for(i = 0; i < screen->h; i++) rows[i] = screenbuf[screen->h - i - 1];
|
||||
write_png(filename, rows, screen->w, screen->h, PNG_COLOR_TYPE_RGBA, 8);
|
||||
write_png(filename, rows, screen->w, screen->h, PNG_COLOR_TYPE_RGB, 8);
|
||||
}
|
||||
|
||||
// ================
|
||||
|
Loading…
Reference in New Issue
Block a user