]> git.sesse.net Git - movit/blobdiff - init.cpp
Add some skeleton code for using GL_ARB_debug_output (disabled by default).
[movit] / init.cpp
index 4802c68712e3b69b086eb5877da28528fc457c3f..b4e69b0f6d444c03eeef24125a357198b03fb89d 100644 (file)
--- a/init.cpp
+++ b/init.cpp
@@ -362,6 +362,17 @@ double get_glsl_version()
        return glsl_version;
 }
 
+void APIENTRY debug_callback(GLenum source,
+                             GLenum type,
+                             GLuint id,
+                             GLenum severity,
+                             GLsizei length,
+                             const char *message,
+                             const void *userParam)
+{
+       printf("Debug: %s\n", message);
+}
+
 }  // namespace
 
 bool init_movit(const string& data_directory, MovitDebugLevel debug_level)
@@ -378,6 +389,12 @@ bool init_movit(const string& data_directory, MovitDebugLevel debug_level)
        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
        glDisable(GL_DITHER);
 
+       // You can turn this on if you want detailed debug messages from the driver.
+       // You should probably also ask for a debug context (see gtest_sdl_main.cpp),
+       // or you might not get much data back.
+       // glDebugMessageCallbackARB(callback, NULL);
+       // glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);
+
        if (!check_extensions()) {
                return false;
        }