diff options
author | Brad Pitcher <bradpitcher@gmail.com> | 2011-11-01 18:29:29 (GMT) |
---|---|---|
committer | Brad Pitcher <bradpitcher@gmail.com> | 2011-11-01 18:29:29 (GMT) |
commit | 0eacddfd8148f14ee0ddfe2eb66b82774c88afbe (patch) | |
tree | 6982ea59564090ea858d12d86d3699e83887f1f9 /tests/system-gl.cc | |
parent | ea7e4988d44249946b620d5973b230cf1a0606ca (diff) | |
parent | e2caf3726d68ff1fef63113519049abffc0563af (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; +} + |