forked from PhotonVision/photon-libcamera-gl-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglerror.h
More file actions
34 lines (29 loc) · 889 Bytes
/
glerror.h
File metadata and controls
34 lines (29 loc) · 889 Bytes
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
#pragma once
#include <iostream>
#include <stdexcept>
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#define GLERROR() glerror(__LINE__)
#define EGLERROR() eglerror(__LINE__)
inline void glerror(int line) {
GLenum error = glGetError();
if (error != GL_NO_ERROR) {
std::string output;
output.resize(128);
snprintf(output.data(), 128, "GL error detected on line %d: 0x%04x\n",
line, error);
std::cout << output << std::endl;
throw std::runtime_error(output);
}
}
inline void eglerror(int line) {
EGLint error = eglGetError();
if (error != EGL_SUCCESS) {
std::string output;
output.resize(128);
snprintf(output.data(), 128, "EGL error detected on line %d: 0x%04x\n",
line, error);
std::cout << output << std::endl;
throw std::runtime_error(output);
}
}