diff options
author | Brad Pitcher <bradpitcher@gmail.com> | 2011-11-01 17:15:35 (GMT) |
---|---|---|
committer | Brad Pitcher <bradpitcher@gmail.com> | 2011-11-01 17:15:35 (GMT) |
commit | e2caf3726d68ff1fef63113519049abffc0563af (patch) | |
tree | 6558c6f03ccc21e7138d23861f80e8d97b09e60e /tests/system-gl.cc | |
parent | 7541854212d6c1223e015faf55a6ca0657a1c184 (diff) | |
parent | cb56f700b1b0f4ae589da62a5fd1d4e368deb604 (diff) |
merge master
Diffstat (limited to 'tests/system-gl.cc')
-rw-r--r-- | tests/system-gl.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/system-gl.cc b/tests/system-gl.cc new file mode 100644 index 0000000..f95a5ca --- /dev/null +++ b/tests/system-gl.cc @@ -0,0 +1,44 @@ + +/* OpenGL helper functions */ + +#include <iostream> +#include "system-gl.h" +#include <boost/algorithm/string.hpp> + +using namespace std; +using namespace boost; + +void glew_dump() { + 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 " ); + cerr << "Extensions: " << endl << " " << extensions << endl; + } + + cerr << " GL_ARB_framebuffer_object: " + << (glewIsSupported("GL_ARB_framebuffer_object") ? "yes" : "no") + << endl + << " GL_EXT_framebuffer_object: " + << (glewIsSupported("GL_EXT_framebuffer_object") ? "yes" : "no") + << endl + << " GL_EXT_packed_depth_stencil: " + << (glewIsSupported("GL_EXT_packed_depth_stencil") ? "yes" : "no") + << endl; +}; + +bool report_glerror(const char * function) +{ + GLenum tGLErr = glGetError(); + if (tGLErr != GL_NO_ERROR) { + cerr << "OpenGL error 0x" << hex << tGLErr << ": " << gluErrorString(tGLErr) << " after " << function << endl; + return true; + } + return false; +} + |