diff options
author | Marius Kintel <marius@kintel.net> | 2011-10-30 01:47:21 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-10-30 01:47:21 (GMT) |
commit | f64dc11d330a50c901facfd1cf5e22b2ca2d5ead (patch) | |
tree | 534b55591fc02c7776a1355a609bc979e210c5a8 /tests/system-gl.cc | |
parent | 9c95cd4c52d649f77169a7481669a5d384968ead (diff) | |
parent | 56979129695ca12ae86bc9b3ea988f7a720d4c8a (diff) |
Merge branch 'visitortests'
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; +} + |