OTB  7.2.0
Orfeo Toolbox
otbGlTypeTraits.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otb_GlTypeTraits_h
22 #define otb_GlTypeTraits_h
23 
24 #include "OTBIceExport.h"
25 
26 
27 #ifdef _WIN32
28 # include <windows.h>
29 #endif
30 
31 #include <GL/glew.h>
32 
33 
34 namespace otb { namespace gl {
35 
36 
37 using Id_t = GLuint;
38 
39 
43 template< typename T >
44 struct TypeTraits
45 {
46 
48  using Type = T;
49 
51  static constexpr GLenum value() noexcept;
52 
53  static char const * name() noexcept;
54 };
55 
56 
58 #define OTB_GL_TYPE_TRAITS( type, glenum, glname ) \
59 
60  \
61  template<> \
63  { \
64  static constexpr GLenum value() noexcept { return glenum; } \
65  \
66  static constexpr char const * name() noexcept { return glname; } \
67  }
69 
70 OTB_GL_TYPE_TRAITS( GLfloat, GL_FLOAT, "GLfloat" );
71 OTB_GL_TYPE_TRAITS( GLdouble, GL_DOUBLE, "GLdouble" );
72 OTB_GL_TYPE_TRAITS( GLint, GL_INT, "GLint" );
73 OTB_GL_TYPE_TRAITS( GLuint, GL_UNSIGNED_INT, "GLuint" );
74 
75 
76 } // end namespace gl.
77 
78 } // end namespace otb.
79 
80 
81 #endif // otb_TypeTraits_h
static char const * name() noexcept
static constexpr char const * name() noexcept
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
GLuint Id_t
Definition: otbGlHandle.h:40
static constexpr GLenum value() noexcept
struct otb::gl::TypeTraits< type > OTB_GL_TYPE_TRAITS(GLfloat, GL_FLOAT, "GLfloat")
static constexpr GLenum value() noexcept