#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/screen/screen-dump.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/screen/screen-dump.hxx>
#include <Cockpit/panel.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Cockpit/panel.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Main/renderer.hxx>
#include <Main/viewmgr.hxx>
#include <GUI/new_gui.hxx>
#include <Main/renderer.hxx>
#include <Main/viewmgr.hxx>
#include <GUI/new_gui.hxx>
/* allocate buffer large enough to store one tile */
GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
if (!tile) {
/* allocate buffer large enough to store one tile */
GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
if (!tile) {
f = fopen(filename, "wb");
if (!f) {
printf("Couldn't open image file: %s\n", filename);
f = fopen(filename, "wb");
if (!f) {
printf("Couldn't open image file: %s\n", filename);
/* Because the HUD and Panel change the ViewPort we will
* need to handle some lowlevel stuff ourselves */
int ncols = trGet(tr, TR_COLUMNS);
/* Because the HUD and Panel change the ViewPort we will
* need to handle some lowlevel stuff ourselves */
int ncols = trGet(tr, TR_COLUMNS);
bool do_panel = fgPanelVisible();
GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
bool do_panel = fgPanelVisible();
GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
SGPath path(dir + '/');
if (path.create_dir( 0755 )) {
SG_LOG(SG_GENERAL, SG_ALERT, "Cannot create screenshot directory '"
SGPath path(dir + '/');
if (path.create_dir( 0755 )) {
SG_LOG(SG_GENERAL, SG_ALERT, "Cannot create screenshot directory '"
- snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
+ snprintf(filename, 24, "fgfs-screen-%03d.png", count++);