Fix Screen::ScreenShot
[ipdf/code.git] / src / screen.cpp
index 712bd26..5f32f0d 100644 (file)
@@ -133,7 +133,11 @@ void Screen::ScreenShot(const char * filename) const
        if (pixels == NULL)
                Fatal("Failed to allocate %d x %d x 4 = %d pixel array", w, h, w*h*4);
 
        if (pixels == NULL)
                Fatal("Failed to allocate %d x %d x 4 = %d pixel array", w, h, w*h*4);
 
-       glReadPixels(0,0,w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+
+       glReadBuffer(GL_FRONT);
+       glPixelStorei(GL_PACK_ALIGNMENT, 1);
+
+       glReadPixels(0,0,w, h, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
 
        SDL_Surface * surf = SDL_CreateRGBSurfaceFrom(pixels, w, h, 8*4, w*4, 0,0,0,0);
        if (surf == NULL)
 
        SDL_Surface * surf = SDL_CreateRGBSurfaceFrom(pixels, w, h, 8*4, w*4, 0,0,0,0);
        if (surf == NULL)

UCC git Repository :: git.ucc.asn.au