From bd751c1a0c3011e285e74684a1afd749d7f385cc Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 8 Feb 2011 22:28:29 +0000 Subject: [PATCH] Allow to specify FPS in the DebugRecord object. --- src/debugrecord.cpp | 9 ++++++--- src/debugrecord.h | 2 +- src/video.cpp | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/debugrecord.cpp b/src/debugrecord.cpp index 4344f25c..6cf2ab58 100644 --- a/src/debugrecord.cpp +++ b/src/debugrecord.cpp @@ -32,7 +32,7 @@ class DebugRecordData private: char const *path; - int width, height; + int width, height, fps; #if defined USE_PIPI pipi_sequence_t *sequence; #endif @@ -42,12 +42,13 @@ private: * Public DebugRecord class */ -DebugRecord::DebugRecord(char const *path) +DebugRecord::DebugRecord(char const *path, float fps) : data(new DebugRecordData()) { data->path = strdup(path); data->width = 0; data->height = 0; + data->fps = (int)(fps + 0.5f); #if defined USE_PIPI data->sequence = NULL; #endif @@ -76,7 +77,9 @@ void DebugRecord::TickDraw(float deltams) if (data->sequence) pipi_close_sequence(data->sequence); - data->sequence = pipi_open_sequence(data->path, width, height, 30); + data->sequence = pipi_open_sequence(data->path, width, height, + 1 /* RGB */, data->fps, + 1, 1, 60 * 1024 * 1024); #endif } diff --git a/src/debugrecord.h b/src/debugrecord.h index 57632780..5d6d6775 100644 --- a/src/debugrecord.h +++ b/src/debugrecord.h @@ -23,7 +23,7 @@ class DebugRecordData; class DebugRecord : public Entity { public: - DebugRecord(char const *path); + DebugRecord(char const *path, float fps); virtual ~DebugRecord(); protected: diff --git a/src/video.cpp b/src/video.cpp index c3a31173..00ee5678 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -120,7 +120,11 @@ void Video::Capture(uint32_t *buffer) glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_ALIGNMENT, 1); +#if defined GL_BGRA + glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, buffer); +#else glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); +#endif for (int j = 0; j < height / 2; j++) for (int i = 0; i < width; i++)