OGLplus  (0.59.0) a C++ wrapper for rendering APIs

config.hpp
Go to the documentation of this file.
1 #ifndef OGLPLUS_GL_API_CONFIG_HPP
9 #define OGLPLUS_GL_API_CONFIG_HPP
10 
11 #include "../config/basic.hpp"
12 #include <eagine/maybe_unused.hpp>
13 
14 #ifndef OGLPLUS_HAS_GL
15 #if defined(GL_NO_ERROR)
16 #define OGLPLUS_HAS_GL 1
17 #else
18 #define OGLPLUS_HAS_GL 0
19 #endif
20 #endif // OGLPLUS_HAS_GL
21 
22 #if !OGLPLUS_HAS_GL
23 #include <eagine/nothing.hpp>
24 #include <cstdint>
25 #endif
26 
27 namespace eagine::oglp {
28 //------------------------------------------------------------------------------
31 struct gl_types {
32 #if OGLPLUS_HAS_GL
33  static constexpr bool has_api = true;
34 #if defined(__GLEW_H__)
35  static constexpr bool has_static_api = false;
36 #else
37  static constexpr bool has_static_api = true;
38 #endif
39  using void_ptr_type = GLvoid*;
41 
43  using const_void_ptr_type = const GLvoid*;
44 
46  using char_type = GLchar;
47 
49  using bool_type = GLboolean;
50 
52  using enum_type = GLenum;
53 
55  using bitfield_type = GLbitfield;
56 
58  using byte_type = GLbyte;
59 
61  using ubyte_type = GLubyte;
62 
64  using short_type = GLshort;
65 
67  using ushort_type = GLushort;
68 
70  using int_type = GLint;
71 
73  using uint_type = GLuint;
74 
76  using int64_type = GLint64;
77 
79  using uint64_type = GLuint64;
80 
82  using float_type = GLfloat;
83 
85  using double_type = GLdouble;
86 
88  using sizei_type = GLsizei;
89 
91  using sizeiptr_type = GLsizeiptr;
92 
94  using intptr_type = GLintptr;
95 
97  using sync_type = GLsync;
98 #else
99  static constexpr bool has_api = false;
100  static constexpr bool has_static_api = true;
101  using void_ptr_type = void*;
102  using const_void_ptr_type = const void*;
103  using char_type = char;
104  using bool_type = bool;
105  using enum_type = unsigned;
106  using bitfield_type = unsigned;
107  using byte_type = std::int8_t;
108  using ubyte_type = std::uint8_t;
109  using short_type = std::int16_t;
110  using ushort_type = std::uint16_t;
111  using int_type = int;
112  using uint_type = unsigned;
113  using int64_type = std::int64_t;
114  using uint64_type = std::uint64_t;
115  using float_type = float;
116  using double_type = double;
117  using sizei_type = std::ptrdiff_t;
118  using sizeiptr_type = std::intptr_t;
119  using intptr_type = std::intptr_t;
120  using sync_type = nothing_t;
121 #endif
122 
125 
127  static constexpr auto bool_true(bool_type b) noexcept -> bool {
128 #if OGLPLUS_HAS_GL
129  return b == GL_TRUE;
130 #else
131  return b;
132 #endif
133  }
134 
136  static constexpr auto error_code_no_error(enum_type ec) noexcept -> bool {
137 #if OGLPLUS_HAS_GL
138  return ec == GL_NO_ERROR;
139 #else
140  EAGINE_MAYBE_UNUSED(ec);
141  return false;
142 #endif
143  }
144 };
145 //------------------------------------------------------------------------------
146 } // namespace eagine::oglp
147 
148 #endif // OGLPLUS_GL_API_CONFIG_HPP
GLsizei sizei_type
Signed integer size type.
Definition: config.hpp:88
GLbitfield bitfield_type
Bit-field type.
Definition: config.hpp:55
GLchar char_type
String character type.
Definition: config.hpp:46
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
GLint int_type
Signed integer type.
Definition: config.hpp:70
Class representing "none" / "nothing" values.
Definition: nothing.hpp:17
GLuint64 uint64_type
Unsigned 64-bit integer type.
Definition: config.hpp:79
GLuint uint_type
Unsigned integer type.
Definition: config.hpp:73
GLsizeiptr sizeiptr_type
Signed integer size type.
Definition: config.hpp:91
const GLvoid * const_void_ptr_type
Untyped const pointer type.
Definition: config.hpp:43
GLboolean bool_type
Boolean type.
Definition: config.hpp:49
GLushort ushort_type
Unsigned short integer type.
Definition: config.hpp:67
Collection of aliases for GL types.
Definition: config.hpp:31
GLubyte ubyte_type
Unsigned-byte type.
Definition: config.hpp:61
GLintptr intptr_type
Signed integer size type.
Definition: config.hpp:94
GLdouble double_type
Double-precision floating-point type.
Definition: config.hpp:85
GLfloat float_type
Floating-point type.
Definition: config.hpp:82
GLvoid * void_ptr_type
Untyped pointer type.
Definition: config.hpp:40
GLbyte byte_type
Byte type.
Definition: config.hpp:58
uint_type name_type
Object handle type.
Definition: config.hpp:124
static constexpr auto bool_true(bool_type b) noexcept -> bool
Converts bool_type value to native bool,.
Definition: config.hpp:127
GLint64 int64_type
Signed 64-bit integer type.
Definition: config.hpp:76
GLsync sync_type
Sync handle type.
Definition: config.hpp:97
GLshort short_type
Signed short integer type.
Definition: config.hpp:64

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).