Browse Source

Allow to specify FPS in the DebugRecord object.

legacy
Sam Hocevar sam 14 years ago
parent
commit
bd751c1a0c
3 changed files with 11 additions and 4 deletions
  1. +6
    -3
      src/debugrecord.cpp
  2. +1
    -1
      src/debugrecord.h
  3. +4
    -0
      src/video.cpp

+ 6
- 3
src/debugrecord.cpp View File

@@ -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
}



+ 1
- 1
src/debugrecord.h View File

@@ -23,7 +23,7 @@ class DebugRecordData;
class DebugRecord : public Entity
{
public:
DebugRecord(char const *path);
DebugRecord(char const *path, float fps);
virtual ~DebugRecord();

protected:


+ 4
- 0
src/video.cpp View File

@@ -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++)


Loading…
Cancel
Save