diff options
-rw-r--r-- | tests/OffscreenContext.mm | 24 | ||||
-rw-r--r-- | tests/system-gl.cc | 5 | ||||
-rw-r--r-- | tests/system-gl.h | 2 |
3 files changed, 11 insertions, 20 deletions
diff --git a/tests/OffscreenContext.mm b/tests/OffscreenContext.mm index 140516f..0c44d7d 100644 --- a/tests/OffscreenContext.mm +++ b/tests/OffscreenContext.mm @@ -1,6 +1,7 @@ #include "OffscreenContext.h" #include "imageutils.h" #include "fbo.h" +#include <iostream> #import <AppKit/AppKit.h> // for NSOpenGL... @@ -47,24 +48,13 @@ OffscreenContext *create_offscreen_context(int w, int h) [ctx->openGLContext makeCurrentContext]; - glewInit(); -#ifdef DEBUG - std::cout << "GLEW version " << glewGetString(GLEW_VERSION) << "\n"; - std::cout << (const char *)glGetString(GL_RENDERER) << "(" << (const char *)glGetString(GL_VENDOR) << ")\n" - << "OpenGL version " << (const char *)glGetString(GL_VERSION) << "\n"; - std::cout << "Extensions: " << (const char *)glGetString(GL_EXTENSIONS) << "\n"; - - - if (GLEW_ARB_framebuffer_object) { - std::cout << "ARB_FBO supported\n"; - } - if (GLEW_EXT_framebuffer_object) { - std::cout << "EXT_FBO supported\n"; - } - if (GLEW_EXT_packed_depth_stencil) { - std::cout << "EXT_packed_depth_stencil\n"; + // glewInit must come after Context creation and before FBO calls. + GLenum err = glewInit(); + if (GLEW_OK != err) { + std::cerr << "Unable to init GLEW: " << glewGetErrorString(err) << std::endl; + return NULL; } -#endif + glew_dump(); ctx->fbo = fbo_new(); if (!fbo_init(ctx->fbo, w, h)) { diff --git a/tests/system-gl.cc b/tests/system-gl.cc index f95a5ca..bdf3bf9 100644 --- a/tests/system-gl.cc +++ b/tests/system-gl.cc @@ -8,13 +8,13 @@ using namespace std; using namespace boost; -void glew_dump() { +void glew_dump(bool dumpall) { +#ifdef DEBUG cerr << "GLEW version: " << glewGetString(GLEW_VERSION) << endl << "Renderer: " << (const char *)glGetString(GL_RENDERER) << endl << "Vendor: " << (const char *)glGetString(GL_VENDOR) << endl << "OpenGL version: " << (const char *)glGetString(GL_VERSION) << endl; - bool dumpall = false; if (dumpall) { string extensions((const char *)glGetString(GL_EXTENSIONS)); replace_all( extensions, " ", "\n " ); @@ -30,6 +30,7 @@ void glew_dump() { << " GL_EXT_packed_depth_stencil: " << (glewIsSupported("GL_EXT_packed_depth_stencil") ? "yes" : "no") << endl; +#endif }; bool report_glerror(const char * function) diff --git a/tests/system-gl.h b/tests/system-gl.h index bb41be5..b41e32c 100644 --- a/tests/system-gl.h +++ b/tests/system-gl.h @@ -3,7 +3,7 @@ #include <GL/glew.h> -void glew_dump(); +void glew_dump(bool dumpall = false); bool report_glerror(const char *task); #endif |