Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / OpenGL / GlutStuff.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose, 
8 including commercial applications, and to alter it and redistribute it freely, 
9 subject to the following restrictions:
10
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 #ifndef GLUT_STUFF_H
16 #define GLUT_STUFF_H
17
18 #ifdef _WIN32//for glut.h
19 #include <windows.h>
20 #endif
21
22 //think different
23 #if defined(__APPLE__) && !defined (VMDMESA)
24 #include <OpenGL/OpenGL.h>
25 #include <OpenGL/gl.h>
26 #include <OpenGL/glu.h>
27 #include <GLUT/glut.h>
28 #else
29
30
31 #ifdef _WINDOWS
32 #include <windows.h>
33 #include <GL/gl.h>
34 #include <GL/glu.h>
35 #else
36 #include <GL/gl.h>
37 #include <GL/glut.h>
38 #endif //_WINDOWS
39 #endif //APPLE
40
41 #ifdef _WINDOWS
42 #define BT_ACTIVE_ALT   VK_LMENU
43
44 #else
45 #define BT_KEY_K 'k'
46 #define BT_KEY_LEFT                     GLUT_KEY_LEFT
47 #define BT_KEY_RIGHT            GLUT_KEY_RIGHT
48 #define BT_KEY_UP                       GLUT_KEY_UP
49 #define BT_KEY_DOWN                     GLUT_KEY_DOWN
50 #define BT_KEY_F1                       GLUT_KEY_F1
51 #define BT_KEY_F2                       GLUT_KEY_F2
52 #define BT_KEY_F3                       GLUT_KEY_F3
53 #define BT_KEY_F4                       GLUT_KEY_F4
54 #define BT_KEY_F5                       GLUT_KEY_F5
55 #define BT_KEY_PAGEUP           GLUT_KEY_PAGE_UP
56 #define BT_KEY_PAGEDOWN         GLUT_KEY_PAGE_DOWN
57 #define BT_KEY_END                      GLUT_KEY_END
58 #define BT_KEY_HOME                     GLUT_KEY_HOME
59 #define BT_ACTIVE_ALT           GLUT_ACTIVE_ALT
60 #define BT_ACTIVE_CTRL          GLUT_ACTIVE_ALT
61 #define BT_ACTIVE_SHIFT         GLUT_ACTIVE_SHIFT
62 #endif
63
64 #if BT_USE_FREEGLUT
65 #include "GL/freeglut_ext.h" //to be able to return from glutMainLoop()
66 #endif
67
68
69
70 class DemoApplication;
71
72 int glutmain(int argc, char **argv,int width,int height,const char* title,DemoApplication* demoApp);
73
74 #if defined(BT_USE_DOUBLE_PRECISION)
75 #define btglLoadMatrix glLoadMatrixd
76 #define btglMultMatrix glMultMatrixd
77 #define btglColor3 glColor3d
78 #define btglVertex3 glVertex3d
79 #else
80 #define btglLoadMatrix glLoadMatrixf
81 #define btglMultMatrix glMultMatrixf
82 #define btglColor3 glColor3f
83 #define btglVertex3 glVertex3d
84 #endif
85
86 #endif //GLUT_STUFF_H