blob: fe9bdce765a555f58b828246437fb649ecbb34a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* 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;
};
const char * gl_errors[] = {
"GL_INVALID_ENUM", // 0x0500
"GL_INVALID_VALUE", // 0x0501
"GL_INVALID_OPERATION", // 0x0502
"GL_OUT_OF_MEMORY" // 0x0503
};
bool report_glerror(const char * function)
{
GLenum tGLErr = glGetError();
if (tGLErr != GL_NO_ERROR) {
if ( (tGLErr-0x500)<=3 && (tGLErr-0x500)>=0 )
cerr << "OpenGL error 0x" << hex << tGLErr << " ("
<< gl_errors[tGLErr-0x500] << ") after " << function << endl;
else
cerr << "OpenGL error 0x" << hex << tGLErr << " after " << function << endl;
return true;
}
return false;
}
|