galaxy
1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
OpenGLError.cpp
Go to the documentation of this file.
1
7
8
#include <glad/glad.h>
9
10
#include "
OpenGLError.hpp
"
11
12
namespace
galaxy
13
{
14
namespace
log
15
{
16
std::string
gl_errcode_as_string
(
const
int
code)
noexcept
17
{
18
switch
(code)
19
{
20
case
GL_INVALID_ENUM:
21
return
"GL_INVALID_ENUM"
;
22
break
;
23
24
case
GL_INVALID_VALUE:
25
return
"GL_INVALID_VALUE"
;
26
break
;
27
28
case
GL_INVALID_OPERATION:
29
return
"GL_INVALID_OPERATION"
;
30
break
;
31
32
case
GL_STACK_OVERFLOW:
33
return
"GL_STACK_OVERFLOW"
;
34
break
;
35
36
case
GL_STACK_UNDERFLOW:
37
return
"GL_STACK_UNDERFLOW"
;
38
break
;
39
40
case
GL_OUT_OF_MEMORY:
41
return
"GL_OUT_OF_MEMORY"
;
42
break
;
43
44
case
GL_INVALID_FRAMEBUFFER_OPERATION:
45
return
"GL_INVALID_FRAMEBUFFER_OPERATION"
;
46
break
;
47
48
default
:
49
return
"GL_NO_ERROR"
;
50
break
;
51
}
52
}
53
54
std::vector<std::string>
gl_get_all_errors
() noexcept
55
{
56
std::vector<std::string> errors;
57
58
GLenum code;
59
while
((code = glGetError()) != GL_NO_ERROR)
60
{
61
errors.emplace_back(
gl_errcode_as_string
(code));
62
}
63
64
return
errors;
65
}
66
67
void
gl_add_error
(
const
unsigned
int
source,
const
unsigned
int
type,
const
unsigned
int
id
,
const
unsigned
int
severity,
const
int
length,
const
char
* buf)
noexcept
68
{
69
glDebugMessageInsert(source, type,
id
, severity, length, buf);
70
}
71
}
// namespace log
72
}
// namespace galaxy
OpenGLError.hpp
galaxy::log::gl_get_all_errors
std::vector< std::string > gl_get_all_errors() noexcept
Returns all GL errors on stack.
Definition
OpenGLError.cpp:54
galaxy::log::gl_add_error
void gl_add_error(const unsigned int source, const unsigned int type, const unsigned int id, const unsigned int severity, const int length, const char *buf) noexcept
Insert a message into the OpenGL debug stack.
Definition
OpenGLError.cpp:67
galaxy::log::gl_errcode_as_string
std::string gl_errcode_as_string(const int code) noexcept
Convert a GL error code to a string.
Definition
OpenGLError.cpp:16
galaxy
Timer.hpp galaxy.
Definition
Timer.cpp:18
galaxy
src
galaxy
logging
OpenGLError.cpp
Generated on Wed Aug 20 2025 08:06:51 for galaxy by
1.12.0