NGL  6.5
The NCCA Graphics Library
Types.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #ifndef TYPES_H_
18 #define TYPES_H_
19 //----------------------------------------------------------------------------------------------------------------------
22 //----------------------------------------------------------------------------------------------------------------------
23 
24 
25 #ifdef __APPLE__
26  #include <unistd.h>
27  #ifndef USINGIOS_
28  #include "glew.h"
29  #else
30  #include <OpenGLES/ES3/gl.h>
31  #include <OpenGLES/ES3/glext.h>
32  #endif
33 
34  #include <TargetConditionals.h>
35  #ifndef TARGET_OS_IPHONE
36  #include <OpenGL/glext.h>
37 #endif
38 
39 #else
40  #include "glew.h"
41  #include <GL/gl.h>
42 #endif
43 
44 
45 
46 #ifndef QT5BUILD
47  #include <QtOpenGL/QGLContext>
48 #endif
49 
50 //----------------------------------------------------------------------------------------------------------------------
51 // DLL Glue for windows build / apps
52 //----------------------------------------------------------------------------------------------------------------------
53 #ifdef WIN32
54  #ifdef BUILDING_DLL
55  #define NGL_DLLEXPORT __declspec(dllexport)
56  #else
57  #define NGL_DLLEXPORT __declspec(dllimport)
58  #endif
59  #ifdef NO_DLL
60  #undef NGL_DLLEXPORT
61  #define NGL_DLLEXPORT
62  #endif
63 
64 #else
65  #define NGL_DLLEXPORT
66 #endif
67 
68 // #ifdef DARWIN
69 // #ifndef GL_TESS_CONTROL_SHADER
70 // #define GL_TESS_CONTROL_SHADER 0x00008e88
71 // #endif
72 // #ifndef GL_TESS_EVALUATION_SHADER
73 // #define GL_TESS_EVALUATION_SHADER 0x00008e87
74 // #endif
75 // #ifndef GL_PATCHES
76 // #define GL_PATCHES 0x0000000e
77 // #endif
78 // #endif
79 
80 
81  extern void* setGL32VisualMac(bool _multisample=true);
82 #ifndef QT5BUILD
83 #include <QGLContext>
84  class CreateCoreGLContext : public QGLContext
85  {
86  public :
87  CreateCoreGLContext(const QGLFormat& format, QPaintDevice* device) : QGLContext(format,device) {;}
88  CreateCoreGLContext(const QGLFormat& format) : QGLContext(format) {;}
89  // under mac this is called and we create the context for GL3.2
90  #ifdef DARWIN
91  #ifndef QT5BUILD
92  virtual void* chooseMacVisual()
93  {
94  return setGL32VisualMac();
95  }
96  #endif
97  #endif
98  };
99 #endif
100 //----------------------------------------------------------------------------------------------------------------------
106 //----------------------------------------------------------------------------------------------------------------------
107 
108 
109 //----------------------------------------------------------------------------------------------------------------------
112 //----------------------------------------------------------------------------------------------------------------------
113 
114 namespace ngl
115 {
116 //----------------------------------------------------------------------------------------------------------------------
119 //----------------------------------------------------------------------------------------------------------------------
120 
122 
123 //----------------------------------------------------------------------------------------------------------------------
125 //----------------------------------------------------------------------------------------------------------------------
126 
128 //----------------------------------------------------------------------------------------------------------------------
130 //----------------------------------------------------------------------------------------------------------------------
131 constexpr float EPSILON = 0.001f;
132 
133 //----------------------------------------------------------------------------------------------------------------------
135 //----------------------------------------------------------------------------------------------------------------------
136  #define FCompare(a,b) \
137  ( ((a)-ngl::EPSILON)<(b) && ((a)+ngl::EPSILON)>(b) )
138 
139 //----------------------------------------------------------------------------------------------------------------------
141 //----------------------------------------------------------------------------------------------------------------------
142 
143  #define NGL_UNUSED(arg) (void)arg;
144 
145 
146 
147 
148 
149 }
150 
151 #endif
152 
153 //----------------------------------------------------------------------------------------------------------------------
CreateCoreGLContext(const QGLFormat &format, QPaintDevice *device)
Definition: Types.h:87
implementation files for RibExport class
Definition: AABB.cpp:22
float GLfloat
Definition: glew.h:289
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
Definition: Types.h:127
void * setGL32VisualMac(bool _multisample=true)
constexpr float EPSILON
define EPSILON for floating point comparison
Definition: Types.h:131
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1257
CreateCoreGLContext(const QGLFormat &format)
Definition: Types.h:88
GLfloat PRECISION
Set the PRECISION of all data types Set PRECISION to be a GLfloat so we only have to change one value...
Definition: Types.h:121