diff options
| author | Tom Adams <Tom_Adams@web.de> | 2010-05-31 20:44:45 +0000 |
|---|---|---|
| committer | Tom Adams <Tom_Adams@web.de> | 2010-05-31 20:44:45 +0000 |
| commit | 30987c20406abfaeceb22df99b052adaf4c53928 (patch) | |
| tree | 28a68c334b1a2cc865676eca9b1618fee5386025 /src/engine/client | |
| parent | c9ff80a17d1bdb2632c13696af71a1352fdf9f20 (diff) | |
| download | zcatch-30987c20406abfaeceb22df99b052adaf4c53928.tar.gz zcatch-30987c20406abfaeceb22df99b052adaf4c53928.zip | |
removed alpha values from screenshots (#742)
Diffstat (limited to 'src/engine/client')
| -rw-r--r-- | src/engine/client/graphics.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp index 7c355fb8..667ba213 100644 --- a/src/engine/client/graphics.cpp +++ b/src/engine/client/graphics.cpp @@ -419,16 +419,16 @@ void CGraphics_OpenGL::ScreenshotDirect(const char *pFilename) int y; int w = m_ScreenWidth; int h = m_ScreenHeight; - unsigned char *pPixelData = (unsigned char *)mem_alloc(w*(h+1)*4, 1); - unsigned char *pTempRow = pPixelData+w*h*4; - glReadPixels(0,0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pPixelData); + unsigned char *pPixelData = (unsigned char *)mem_alloc(w*(h+1)*3, 1); + unsigned char *pTempRow = pPixelData+w*h*3; + glReadPixels(0,0, w, h, GL_RGB, GL_UNSIGNED_BYTE, pPixelData); // flip the pixel because opengl works from bottom left corner for(y = 0; y < h/2; y++) { - mem_copy(pTempRow, pPixelData+y*w*4, w*4); - mem_copy(pPixelData+y*w*4, pPixelData+(h-y-1)*w*4, w*4); - mem_copy(pPixelData+(h-y-1)*w*4, pTempRow,w*4); + mem_copy(pTempRow, pPixelData+y*w*3, w*3); + mem_copy(pPixelData+y*w*3, pPixelData+(h-y-1)*w*3, w*3); + mem_copy(pPixelData+(h-y-1)*w*3, pTempRow,w*3); } // find filename @@ -443,7 +443,7 @@ void CGraphics_OpenGL::ScreenshotDirect(const char *pFilename) // save png dbg_msg("client", "saved screenshot to '%s'", aWholePath); png_open_file_write(&Png, aWholePath); // ignore_convention - png_set_data(&Png, w, h, 8, PNG_TRUECOLOR_ALPHA, (unsigned char *)pPixelData); // ignore_convention + png_set_data(&Png, w, h, 8, PNG_TRUECOLOR, (unsigned char *)pPixelData); // ignore_convention png_close_file(&Png); // ignore_convention } |