Commit e35c4847 authored by Janis Born's avatar Janis Born

add saveScreenshot function which just takes a filename parameter

parent 4c547a0f
......@@ -31,12 +31,15 @@ SharedTextureData loadTextureData(const std::string &_filename);
//! generic save function that will use one of the saving functions below based on the file ending
bool saveTextureData(const SharedTextureData &_textureData, const std::string &_filename);
//! saves the viewport visible part of the framebuffer 0 to a file named _fileName. The file ending determines the file type
bool saveScreenshot( const std::string& _fileName );
//! saves the viewport visible part of the framebuffer 0 to a file named _prefix_DATE-TIME._fileEnding
bool saveScreenshot( const std::string &_prefix, const std::string _fileEnding);
bool saveScreenshotWithDate( const std::string& _prefix, const std::string& _fileEnding);
//! saves the viewport visible part of the framebuffer 0 to a file named screenshot_DATE-TIME._fileEnding
inline bool saveScreenshot( const std::string _fileEnding = "png" ) {
return saveScreenshot( "screenshot", _fileEnding );
inline bool saveScreenshotWithDate( const std::string& _fileEnding = "png" ) {
return saveScreenshotWithDate( "screenshot", _fileEnding );
}
///////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -106,8 +106,15 @@ bool saveTextureData(const SharedTextureData &_textureData, const std::string &_
return false;
}
bool saveScreenshot(const std::string& _fileName)
{
ACGL::OpenGL::SharedTextureData screenShot = FrameBufferObject::getImageData();
bool success = ACGL::OpenGL::saveTextureData( screenShot, _fileName );
return success;
}
bool saveScreenshot( const std::string &_prefix, const std::string _fileEnding )
bool saveScreenshotWithDate(const std::string& _prefix, const std::string& _fileEnding )
{
time_t rawtime;
time( &rawtime );
......@@ -120,10 +127,7 @@ bool saveScreenshot( const std::string &_prefix, const std::string _fileEnding )
std::string filename = _prefix + timestring + "_" + ACGL::Base::StringOperations::toString(i) + "." + _fileEnding;
ACGL::OpenGL::SharedTextureData screenShot = FrameBufferObject::getImageData();
bool success = ACGL::OpenGL::saveTextureData( screenShot, filename );
return success;
return saveScreenshot(filename);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment