- bugfix for corrupted screenshots in g3d viewer reported by tomreyn

This commit is contained in:
Mark Vejvoda 2011-05-16 13:14:54 +00:00
parent f3c11138db
commit c0e4657f68
1 changed files with 5 additions and 0 deletions

View File

@ -473,8 +473,13 @@ void Renderer::setAlphaColor(float alpha) {
void Renderer::saveScreen(const string &path) {
Pixmap2D *pixmapScreenShot = new Pixmap2D(width, height, 4);
glFinish();
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(),GL_RGBA, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels());
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
pixmapScreenShot->save(path);
delete pixmapScreenShot;
}