From 7b69d3040f63f464f60cdf50d3a0947c8a99bc9d Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 4 Jan 2012 21:43:34 +0000 Subject: [PATCH] - bugfix on windows for autoscreenshots in g3d viewer --- source/g3d_viewer/main.cpp | 8 +++++--- source/g3d_viewer/renderer.cpp | 5 +++-- source/glest_game/graphics/renderer.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp index dda7f4284..398fef580 100644 --- a/source/g3d_viewer/main.cpp +++ b/source/g3d_viewer/main.cpp @@ -616,8 +616,7 @@ void MainWindow::onPaint(wxPaintEvent &event) { } renderer->renderParticleManager(); - glCanvas->SwapBuffers(); - + bool haveLoadedParticles = (particleProjectilePathList.empty() == false || particleSplashPathList.empty() == false); if(autoScreenShotAndExit == true) { @@ -629,7 +628,10 @@ void MainWindow::onPaint(wxPaintEvent &event) { Close(); return; } - else if((modelPathList.empty() == false) && resetAnimation && haveLoadedParticles) { + + glCanvas->SwapBuffers(); + + if((modelPathList.empty() == false) && resetAnimation && haveLoadedParticles) { if(anim >= resetAnim && resetAnim > 0) { printf("RESETTING EVERYTHING [%f][%f]...\n",anim,resetAnim); fflush(stdout); diff --git a/source/g3d_viewer/renderer.cpp b/source/g3d_viewer/renderer.cpp index 87b363053..7a5e15890 100644 --- a/source/g3d_viewer/renderer.cpp +++ b/source/g3d_viewer/renderer.cpp @@ -485,11 +485,12 @@ void Renderer::setAlphaColor(float alpha) { void Renderer::saveScreen(const string &path) { Pixmap2D *pixmapScreenShot = new Pixmap2D(width, height, 4); - glFinish(); + //glFinish(); glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(),GL_RGBA, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels()); + glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(), + GL_RGBA, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels()); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 1306dc993..324de6f99 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -6395,7 +6395,7 @@ void Renderer::saveScreen(const string &path) { Pixmap2D *pixmapScreenShot = new Pixmap2D(sm.getScreenW(), sm.getScreenH(), 3); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - glFinish(); + //glFinish(); glPixelStorei(GL_PACK_ALIGNMENT, 1);