From bae25b0b688e95f821d4c305a3a6e8e4a64e8c6e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 6 Jan 2015 22:14:10 +0000 Subject: Corrected savegame screenshots on win32. --- src/client/savegamemenu.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/savegamemenu.cc b/src/client/savegamemenu.cc index c2601a5..d002b54 100644 --- a/src/client/savegamemenu.cc +++ b/src/client/savegamemenu.cc @@ -555,7 +555,14 @@ void SaveGameMenu::savescreenshot(std::string savename) std::string filename(filesystem::writedir() + "savegames/" + savename + ".jpg"); // redraw the world without ui - + /* + hack: win32 seems to have triple buffering or reads pixels from the wrong buffer + the workaround is to render the world twice + */ + +#ifdef __WIN32 + for (size_t i = 0; i < 2; ++i) { +#endif // Clear the color and depth buffers. gl::clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -571,7 +578,9 @@ void SaveGameMenu::savescreenshot(std::string savename) gl::disable(GL_BLEND); video::swap_buffers(); - +#ifdef __WIN32 + } +#endif render::Screenshot::savegameshot(filename); } -- cgit v1.2.3