- added ability to specify scaled image size of screenshots in g3d viewer example:

./megaglest_g3dviewer --load-unit=techs/megapack/factions/romans/units/catapult,attack_skill --auto-screenshot=resize-1024x768
This commit is contained in:
Mark Vejvoda
2012-01-06 18:49:33 +00:00
parent 8e4ed05159
commit d449517872
4 changed files with 39 additions and 9 deletions

View File

@@ -483,7 +483,7 @@ void Renderer::setAlphaColor(float alpha) {
//printf("#3.1 The framebuffer uses %d bit(s) per the alpha component\n", alpha_bits);
}
void Renderer::saveScreen(const string &path) {
void Renderer::saveScreen(const string &path,std::pair<int,int> *overrideSize) {
Pixmap2D *pixmapScreenShot = new Pixmap2D(width, height, 4);
//glFinish();
@@ -494,6 +494,10 @@ void Renderer::saveScreen(const string &path) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if(overrideSize != NULL && overrideSize->first > 0 && overrideSize->second > 0) {
pixmapScreenShot->Scale(GL_RGBA,overrideSize->first,overrideSize->second);
}
pixmapScreenShot->save(path);
delete pixmapScreenShot;
}