Skip to content

Commit

Permalink
Proof of concept screen capture.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbontar committed Jan 21, 2016
1 parent 088d848 commit c4c5ce9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/drivers/inferno/inferno.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


#include "berniw.h"
#include <tgfclient.h>


// Function prototypes.
Expand Down Expand Up @@ -172,6 +173,18 @@ static void drive(int index, tCarElt* car, tSituation *situation)
tdble b5; // Brake for the pit;
tdble steer, targetAngle, shiftaccel;

static int screenshot = 0;
if (screenshot == 0) {
screenshot = 1;

const int cam_width = 640;
const int cam_height = 480;
unsigned char cam_data[3 * cam_width * cam_height];
glReadPixels(0, 0, cam_width, cam_height, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)cam_data);
GfImgWritePng(cam_data, "/tmp/foo.png", cam_width, cam_height);
printf("Screenshot written to /tmp/foo.png\n");
}

MyCar* myc = mycar[index-1];
Pathfinder* mpf = myc->getPathfinderPtr();

Expand Down

0 comments on commit c4c5ce9

Please sign in to comment.