-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomplain.cpp
47 lines (37 loc) · 1.14 KB
/
complain.cpp
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
#include "complain.hpp"
#include "gl.hpp"
#include <iostream>
void doComplain(const char *where, const std::string &msg)
{
std::cerr << where << ": " << msg << '\n';
}
void doOnGLErrorComplain(const char *where)
{
for (;;) {
GLint err = glGetError();
if (!err)
return;
std::string errName;
switch (err) {
case GL_INVALID_ENUM:
errName = "GL_INVALID_ENUM";
break;
case GL_INVALID_VALUE:
errName = "GL_INVALID_VALUE";
break;
case GL_INVALID_OPERATION:
errName = "GL_INVALID_OPERATION";
break;
case GL_INVALID_FRAMEBUFFER_OPERATION:
errName = "GL_INVALID_FRAMEBUFFER_OPERATION";
break;
case GL_OUT_OF_MEMORY:
errName = "GL_OUT_OF_MEMORY";
break;
default:
errName = "(unknown GL error)";
break;
}
std::cerr << where << ": " << errName << '\n';
}
}