void PlatformWindow::makeScreenShot(std::string file) {
boost::filesystem::path dirPath(file);
if (!g_resources.directoryExists(dirPath.parent_path().string())) {
g_logger.error("Unable to find path: " + dirPath.parent_path().string());
return;
}
uint arrayLength = 4 * getWidth() * getHeight();
uint widthLength = getWidth();
uint heightLength = getHeight();
uint8_t* pixels = new uint8_t[arrayLength];
glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, pixels);
GLenum error = glGetError(); //My check
if (error != GL_NO_ERROR) {
g_logger.error("OpenGL error while reading pixels: " + std::to_string(error));
return;
}
boost::thread thread = boost::thread(&PlatformWindow::changeScreenShotOrientation, this, pixels, arrayLength, widthLength, heightLength, file);
}