-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglerror.cpp
More file actions
48 lines (45 loc) · 1.28 KB
/
glerror.cpp
File metadata and controls
48 lines (45 loc) · 1.28 KB
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
#include "glerror.h"
#ifdef WIN32
# include <GL/glew.h>
#elif __APPLE__
# include <OpenGL/gl3.h>
#else
# include <GL/gl.h>
#endif
using namespace std;
void _check_gl_error(const char *file, int line) {
QString prefix = "File: ";
prefix += file;
prefix += " :";
prefix += file;
// prefix.append(file);
// prefix << ":" << line;
switch (glGetError()) {
{
case GL_NO_ERROR:
//qDebug() << prefix << tr("No error.");
break;
case GL_INVALID_ENUM:
qDebug() << prefix << QObject::tr("Invalid enum.");
break;
case GL_INVALID_VALUE:
qDebug() << prefix << QObject::tr("Invalid value.");
break;
case GL_INVALID_OPERATION:
qDebug() << prefix << QObject::tr("Invalid operation.");
break;
case GL_STACK_OVERFLOW:
qDebug() << prefix << QObject::tr("Stack overflow.");
break;
case GL_STACK_UNDERFLOW:
qDebug() << prefix << QObject::tr("Stack underflow.");
break;
case GL_OUT_OF_MEMORY:
qDebug() << prefix << QObject::tr("Out of memory.");
break;
default:
qDebug() << prefix << QObject::tr("Unknown error.");
break;
}
}
}