PCB Environment 2

Loading...
Searching...
No Matches
GLContext.hpp
1
2#ifndef GYM_PCB_UI_GLCONTEXT_H
3#define GYM_PCB_UI_GLCONTEXT_H
4
5#include "GLWidget.hpp"
6
7 namespace GL
8{
9
10 inline GLWidget *getContext()
11{
12 return GLWidget::getInstance();
13}
14
15 inline bool CheckErrors(const char *info)
16{
17 auto ctx = getContext();
18 auto err = ctx->glGetError();
19 if (err == GL_NO_ERROR)
20 return false;
21 do {
22 switch (err) {
23 default:
24 qWarning("%s: GL_ERROR_%04x", info, err);
25 break;
26 case GL_INVALID_OPERATION: qWarning("%s: GL_INVALID_OPERATION", info); break;
27 }
28 err = ctx->glGetError();
29 } while (err != GL_NO_ERROR);
30 return true;
31}
32
33} // namespace GL
34
35#endif // GYM_PCB_UI_GLCONTEXT_H