Go to the documentation of this file. 1 #ifndef OGLPLUS_GL_API_RESULT_HPP
9 #define OGLPLUS_GL_API_RESULT_HPP
16 namespace eagine::oglp {
30 return {
"GL function not available"};
43 explicit constexpr
operator bool() const noexcept {
54 #ifdef GL_INVALID_ENUM
55 if(_error_code == GL_INVALID_ENUM) {
56 return {
"invalid enum value"};
59 #ifdef GL_INVALID_VALUE
60 if(_error_code == GL_INVALID_VALUE) {
61 return {
"invalid value"};
64 #ifdef GL_INVALID_OPERATION
65 if(_error_code == GL_INVALID_OPERATION) {
66 return {
"invalid operation"};
69 #ifdef GL_INVALID_FRAMEBUFFER_OPERATION
70 if(_error_code == GL_INVALID_FRAMEBUFFER_OPERATION) {
71 return {
"invalid framebuffer operation"};
75 if(_error_code == GL_NO_ERROR) {
79 #ifdef GL_STACK_OVERFLOW
80 if(_error_code == GL_STACK_OVERFLOW) {
81 return {
"stack overflow"};
84 #ifdef GL_STACK_UNDERFLOW
85 if(_error_code == GL_STACK_UNDERFLOW) {
86 return {
"stack underflow"};
89 #ifdef GL_TABLE_TOO_LARGE
90 if(_error_code == GL_TABLE_TOO_LARGE) {
91 return {
"table too large"};
94 #ifdef GL_CONTEXT_LOST
95 if(_error_code == GL_CONTEXT_LOST) {
96 return {
"rendering context lost"};
99 #ifdef GL_OUT_OF_MEMORY
100 if(_error_code == GL_OUT_OF_MEMORY) {
101 return {
"out of memory"};
104 return {
"unknown error"};
119 template <
typename Result>
126 template <
typename Result>
133 template <
typename Result>
141 template <
typename Result>
146 #endif // OGLPLUS_GL_API_RESULT_HPP
Class wrapping the result of a C-API function call.
Definition: c_api_wrap.hpp:210
Class storing information about call result for unavailable GL functions.
Definition: result.hpp:22
api_no_result< Result, gl_no_result_info > gl_no_result
Alias for always-invalid result of a missing GL API function call.
Definition: result.hpp:120
Typed enumeration for GL error code constants.
Definition: enum_types.hpp:32
api_combined_result< Result, gl_result_info > gl_combined_result
Alias for a result that may come from mutiple difference GL API functions.
Definition: result.hpp:142
constexpr auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:29
GLenum enum_type
Enumeration type.
Definition: config.hpp:52
static constexpr auto error_code_no_error(enum_type ec) noexcept -> bool
Tests if the specified error code represents no-error value.
Definition: config.hpp:136
auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:53
Class storing information about a GL function call result.
Definition: result.hpp:40
api_result< Result, Info, api_result_validity::maybe > api_opt_result
Alias for conditionally-valid result of a C-API function call.
Definition: c_api_wrap.hpp:218
api_result< Result, Info, api_result_validity::never > api_no_result
Alias for always-invalid result of a C-API function call.
Definition: c_api_wrap.hpp:226
Type that can by constructed from single argument of any other type.
Definition: anything.hpp:16
api_opt_result< Result, gl_result_info > gl_opt_result
Alias for conditionally-valid result of a GL API function call.
Definition: result.hpp:134