Created
April 18, 2017 02:19
-
-
Save Benau/a42f4c8d1c95db18b224cd8601cd7fd8 to your computer and use it in GitHub Desktop.
ST recorder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/supertux/screen_manager.cpp b/src/supertux/screen_manager.cpp | |
index 3cf95d8..6ed59c7 100644 | |
--- a/src/supertux/screen_manager.cpp | |
+++ b/src/supertux/screen_manager.cpp | |
@@ -44,6 +44,8 @@ | |
#include <stdio.h> | |
+#include <openglrecorder.h> | |
+ | |
#ifdef WIN32 | |
# define snprintf _snprintf | |
#endif | |
@@ -73,6 +75,7 @@ ScreenManager::~ScreenManager() | |
using namespace scripting; | |
delete TimeScheduler::instance; | |
TimeScheduler::instance = NULL; | |
+ ogrDestroy(); | |
} | |
void | |
@@ -206,6 +209,29 @@ ScreenManager::draw(DrawingContext& context) | |
fps_ticks = SDL_GetTicks(); | |
} | |
} | |
+ static bool init = false; | |
+ if (init == false) | |
+ { | |
+ init=true; | |
+ RecorderConfig cfg; | |
+ cfg.m_triple_buffering = 1; | |
+ cfg.m_record_audio = 1; | |
+ cfg.m_width = 1280; | |
+ cfg.m_height = 720; | |
+ cfg.m_video_format = OGR_VF_H264; | |
+ cfg.m_audio_format = OGR_AF_VORBIS; | |
+ cfg.m_audio_bitrate = 112000; | |
+ cfg.m_video_bitrate = 200000; | |
+ cfg.m_record_fps = 30; | |
+ cfg.m_record_jpg_quality = 90; | |
+ ogrInitConfig(&cfg); | |
+ ogrRegReadPixelsFunction(glReadPixels); | |
+ ogrRegPBOFunctions(glGenBuffers, glBindBuffer, glBufferData, | |
+ glDeleteBuffers, glMapBuffer, glUnmapBuffer); | |
+ ogrSetSavedName("record"); | |
+ ogrPrepareCapture(); | |
+ } | |
+ ogrCapture(); | |
} | |
void |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment