CHAI3D
3.0.0
Main Page
Overview
Documentation
CGlobals.h
Go to the documentation of this file.
1
//==============================================================================
2
/*
3
Software License Agreement (BSD License)
4
Copyright (c) 2003-2015, CHAI3D.
5
(www.chai3d.org)
6
7
All rights reserved.
8
9
Redistribution and use in source and binary forms, with or without
10
modification, are permitted provided that the following conditions
11
are met:
12
13
* Redistributions of source code must retain the above copyright
14
notice, this list of conditions and the following disclaimer.
15
16
* Redistributions in binary form must reproduce the above
17
copyright notice, this list of conditions and the following
18
disclaimer in the documentation and/or other materials provided
19
with the distribution.
20
21
* Neither the name of CHAI3D nor the names of its contributors may
22
be used to endorse or promote products derived from this software
23
without specific prior written permission.
24
25
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
POSSIBILITY OF SUCH DAMAGE.
37
38
\author <http://www.chai3d.org>
39
\author Francois Conti
40
\version 3.0.0 $Rev: 1692 $
41
*/
42
//==============================================================================
43
44
//------------------------------------------------------------------------------
45
#ifndef CGlobalsH
46
#define CGlobalsH
47
//------------------------------------------------------------------------------
48
49
//==============================================================================
85
//==============================================================================
86
87
//------------------------------------------------------------------------------
88
#ifndef DOXYGEN_SHOULD_SKIP_THIS
89
//------------------------------------------------------------------------------
90
91
//==============================================================================
92
// GENERAL SETTINGS
93
//==============================================================================
94
95
//------------------------------------------------------------------------------
96
// STANDARD LIBRARIES
97
//------------------------------------------------------------------------------
98
99
#include <cstdlib>
100
#include <cstring>
101
#include <memory>
102
103
104
//------------------------------------------------------------------------------
105
// COMPILING OPTIONS
106
//------------------------------------------------------------------------------
107
108
// OPENGL SUPPORT
109
// Enable or disable OpenGL and GLEW libraries.
110
#define C_USE_OPENGL
111
112
// EIGEN SUPPORT
113
// Enable or disable external Eigen math library.
114
#define C_USE_EIGEN
115
116
// 3DS FILE SUPPORT
117
// Enable or disable external support for 3DS files.
118
#define C_USE_FILE_3DS
119
120
// GIF FILE SUPPORT
121
// Enable or disable external support for GIF files.
122
#define C_USE_FILE_GIF
123
124
// JPG FILE SUPPORT
125
// Enable or disable external support for JPG files.
126
#define C_USE_FILE_JPG
127
128
// PNG FILE SUPPORT
129
// Enable of disable external support for PNG files.
130
#define C_USE_FILE_PNG
131
132
133
//------------------------------------------------------------------------------
134
// OPTIONS
135
//------------------------------------------------------------------------------
136
137
// Maximum supported display contexts.
138
const
int
C_MAX_DISPLAY_CONTEXTS = 4;
139
140
141
//==============================================================================
142
// OPERATING SYSTEM SPECIFIC
143
//==============================================================================
144
145
//------------------------------------------------------------------------------
146
// WIN32 / WIN64 OS
147
//------------------------------------------------------------------------------
148
#if defined(WIN32) | defined(WIN64)
149
150
//--------------------------------------------------------------------
151
// GENERAL
152
//--------------------------------------------------------------------
153
154
// OS specific
155
#if !defined(NOMINMAX)
156
#define NOMINMAX
157
#endif
158
#include <windows.h>
159
160
// if building with .NET, we need to explicitly tell MSVC that we are using unmanaged code
161
// http://msdn.microsoft.com/en-us/library/4ex65770(v=vs.110).aspx
162
#if (_MANAGED == 1)
163
#define nullptr __nullptr
164
#endif
165
166
// printf
167
#include <conio.h>
168
#define cPrint _cprintf
169
170
// math
171
#if !defined(C_USE_EIGEN)
172
#define _USE_MATH_DEFINES
173
#include <cmath>
174
#endif
175
176
// OpenGL GLEW library
177
#if defined(C_USE_OPENGL)
178
#ifndef GLEW_STATIC
179
#define GLEW_STATIC
180
#endif
181
#endif
182
183
//--------------------------------------------------------------------
184
// HAPTIC DEVICES
185
//--------------------------------------------------------------------
186
#define C_ENABLE_CUSTOM_DEVICE_SUPPORT
187
#define C_ENABLE_DELTA_DEVICE_SUPPORT
188
#define C_ENABLE_PHANTOM_DEVICE_SUPPORT
189
// #define C_ENABLE_SIXENSE_DEVICE_SUPPORT
190
191
//--------------------------------------------------------------------
192
// SYSTEM LIBRARIES
193
//--------------------------------------------------------------------
194
#pragma comment (lib, "winmm.lib")
195
196
#endif
197
198
199
//------------------------------------------------------------------------------
200
// LINUX OS
201
//------------------------------------------------------------------------------
202
#if defined(LINUX)
203
204
//--------------------------------------------------------------------
205
// GENERAL
206
//--------------------------------------------------------------------
207
208
// OS specific
209
#include <ctime>
210
#include <pthread.h>
211
#include <dlfcn.h>
212
213
// printf
214
#define cPrint printf
215
216
//--------------------------------------------------------------------
217
// HAPTIC DEVICES
218
//--------------------------------------------------------------------
219
#define C_ENABLE_CUSTOM_DEVICE_SUPPORT
220
#define C_ENABLE_SIXENSE_DEVICE_SUPPORT
221
#define C_ENABLE_DELTA_DEVICE_SUPPORT
222
#define C_ENABLE_PHANTOM_DEVICE_SUPPORT
223
224
#endif
225
226
227
//------------------------------------------------------------------------------
228
// MAC OS
229
//------------------------------------------------------------------------------
230
#if defined(MACOSX)
231
232
//--------------------------------------------------------------------
233
// GENERAL
234
//--------------------------------------------------------------------
235
236
// OS specific
237
#include <mach/mach_time.h>
238
#include <pthread.h>
239
#include <dlfcn.h>
240
241
// printf
242
#define cPrint printf
243
244
//--------------------------------------------------------------------
245
// HAPTIC DEVICES
246
//--------------------------------------------------------------------
247
#define C_ENABLE_CUSTOM_DEVICE_SUPPORT
248
#define C_ENABLE_DELTA_DEVICE_SUPPORT
249
250
#endif
251
252
253
//------------------------------------------------------------------------------
254
#endif // DOXYGEN_SHOULD_SKIP_THIS
255
//------------------------------------------------------------------------------
256
257
258
//==============================================================================
259
// GENERAL PURPOSE FUNCTIONS:
260
//==============================================================================
261
262
//------------------------------------------------------------------------------
263
namespace
chai3d
{
264
//------------------------------------------------------------------------------
265
267
void
cSleepMs
(
const
unsigned
int
a_interval);
268
269
270
//------------------------------------------------------------------------------
271
#ifndef DOXYGEN_SHOULD_SKIP_THIS
272
//------------------------------------------------------------------------------
273
274
//==============================================================================
275
// CHAI3D - OPENGL:
276
//==============================================================================
277
278
//------------------------------------------------------------------------------
279
// The following definitions allow CHAI3D to compile without the external OpenGL
280
// libraries. This mode of compilation is controlled by the flag C_USE_OPENGL.
281
// Compiling the framework without OpenGL can be very useful if you plan to
282
// use CHAI3D for haptic rendering purposes only, or on real-time operating
283
// systems such as QNX or VxWorks for instance where OpenGL is not supported.
284
//------------------------------------------------------------------------------
285
286
#ifndef C_USE_OPENGL
287
288
typedef
unsigned
int
GLenum;
289
typedef
unsigned
int
GLuint;
290
typedef
int
GLint;
291
typedef
int
GLsizei;
292
typedef
unsigned
char
GLboolean;
293
typedef
signed
char
GLbyte;
294
typedef
short
GLshort;
295
typedef
unsigned
char
GLubyte;
296
typedef
unsigned
short
GLushort;
297
typedef
unsigned
long
GLulong;
298
typedef
float
GLfloat;
299
typedef
float
GLclampf;
300
typedef
double
GLdouble;
301
typedef
double
GLclampd;
302
303
#define GL_FALSE 0
304
#define GL_TRUE 1
305
#define GL_EXP 0x0800
306
#define GL_EXP2 0x0801
307
#define GL_UNSIGNED_BYTE 0x1401
308
#define GL_LINE 0x1B01
309
#define GL_POINTS 0x0000
310
#define GL_BYTE 0x1400
311
#define GL_SHORT 0x1402
312
#define GL_UNSIGNED_SHORT 0x1403
313
#define GL_UNSIGNED_INT 0x1405
314
#define GL_DEPTH_COMPONENT 0x1902
315
#define GL_RGB 0x1907
316
#define GL_RGBA 0x1908
317
#define GL_LUMINANCE 0x1909
318
#define GL_LUMINANCE_ALPHA 0x190A
319
#define GL_TEXTURE0 0x84C0
320
#define GL_TEXTURE1 0x84C1
321
#define GL_TEXTURE2 0x84C2
322
#define GL_TEXTURE3 0x84C3
323
#define GL_TEXTURE4 0x84C4
324
#define GL_POINT 0x1B00
325
#define GL_LINE 0x1B01
326
#define GL_FILL 0x1B02
327
#define GL_MODULATE 0x2100
328
#define GL_DECAL 0x2101
329
#define GL_LINEAR 0x2601
330
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
331
#define GL_CLAMP 0x2900
332
#define GL_REPEAT 0x2901
333
#define GL_LIGHT0 0x4000
334
#define GLUquadricObj void
335
336
#define GL_CLAMP_TO_EDGE 0x812F
337
#define GL_NEAREST 0x2600
338
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
339
340
#endif // C_USE_OPENGL
341
342
//------------------------------------------------------------------------------
343
#endif // DOXYGEN_SHOULD_SKIP_THIS
344
//------------------------------------------------------------------------------
345
}
// namespace chai3d
346
//------------------------------------------------------------------------------
347
348
//------------------------------------------------------------------------------
349
#endif
350
//------------------------------------------------------------------------------
chai3d
Definition:
CAudioBuffer.cpp:56
chai3d::cSleepMs
void cSleepMs(const unsigned int a_interval)
This function suspends the execution of the current thread for a specified interval.
Definition:
CGlobals.cpp:60
CHAI3D 3.0.0 documentation
Please address any questions to
support@chai3d.org
(C) 2003-2015 -
CHAI3D
All Rights Reserved.