OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GL.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSG_OPENGL
15 #define OSG_OPENGL 1
16 
17 #include <osg/Config>
18 #include <osg/Export>
19 #include <osg/Types>
20 
21 #define OSG_GL1_AVAILABLE
22 #define OSG_GL2_AVAILABLE
23 /* #undef OSG_GL3_AVAILABLE */
24 /* #undef OSG_GLES1_AVAILABLE */
25 /* #undef OSG_GLES2_AVAILABLE */
26 /* #undef OSG_GLES3_AVAILABLE */
27 /* #undef OSG_GL_LIBRARY_STATIC */
28 #define OSG_GL_DISPLAYLISTS_AVAILABLE
29 #define OSG_GL_MATRICES_AVAILABLE
30 #define OSG_GL_VERTEX_FUNCS_AVAILABLE
31 #define OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
32 #define OSG_GL_FIXED_FUNCTION_AVAILABLE
33 #define GL_HEADER_HAS_GLINT64
34 #define GL_HEADER_HAS_GLUINT64
35 
36 #define OSG_GL1_FEATURES true
37 #define OSG_GL2_FEATURES true
38 #define OSG_GL3_FEATURES false
39 #define OSG_GLES1_FEATURES false
40 #define OSG_GLES2_FEATURES false
41 #define OSG_GLES3_FEATURES false
42 
43 
44 #ifndef WIN32
45 
46  // Required for compatibility with glext.h sytle function definitions of
47  // OpenGL extensions, such as in src/osg/Point.cpp.
48  #ifndef APIENTRY
49  #define APIENTRY
50  #endif
51 
52 #else // WIN32
53 
54  #if defined(__CYGWIN__) || defined(__MINGW32__)
55 
56  #ifndef APIENTRY
57  #define GLUT_APIENTRY_DEFINED
58  #define APIENTRY __stdcall
59  #endif
60  // XXX This is from Win32's <windef.h>
61  #ifndef CALLBACK
62  #define CALLBACK __stdcall
63  #endif
64 
65  #else // ! __CYGWIN__
66 
67  // Under Windows avoid including <windows.h>
68  // to avoid name space pollution, but Win32's <GL/gl.h>
69  // needs APIENTRY and WINGDIAPI defined properly.
70  // XXX This is from Win32's <windef.h>
71  #ifndef APIENTRY
72  #define GLUT_APIENTRY_DEFINED
73  #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
74  #define WINAPI __stdcall
75  #define APIENTRY WINAPI
76  #else
77  #define APIENTRY
78  #endif
79  #endif
80 
81  // XXX This is from Win32's <windef.h>
82  #ifndef CALLBACK
83  #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
84  #define CALLBACK __stdcall
85  #else
86  #define CALLBACK
87  #endif
88  #endif
89 
90  #endif // __CYGWIN__
91 
92  // XXX This is from Win32's <wingdi.h> and <winnt.h>
93  #ifndef WINGDIAPI
94  #define GLUT_WINGDIAPI_DEFINED
95  #define DECLSPEC_IMPORT __declspec(dllimport)
96  #define WINGDIAPI DECLSPEC_IMPORT
97  #endif
98 
99  // XXX This is from Win32's <ctype.h>
100  #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&(__GNUC__ > 2))
101  typedef unsigned short wchar_t;
102  #define _WCHAR_T_DEFINED
103  #endif
104 
105 #endif // WIN32
106 
107 #if defined(OSG_GL3_AVAILABLE)
108  #define GL3_PROTOTYPES 1
109  #define GL_GLEXT_PROTOTYPES 1
110 #endif
111 
112 
113 #include <GL/gl.h>
114 
115 
116 
117 #ifndef GL_APIENTRY
118  #define GL_APIENTRY APIENTRY
119 #endif // GL_APIENTRY
120 
121 
122 #ifndef GL_HEADER_HAS_GLINT64
123  typedef int64_t GLint64;
124 #endif
125 
126 #ifndef GL_HEADER_HAS_GLUINT64
127  typedef uint64_t GLuint64;
128 #endif
129 
130 #ifdef OSG_GL_MATRICES_AVAILABLE
131 
132  inline void glLoadMatrix(const float* mat) { glLoadMatrixf(static_cast<const GLfloat*>(mat)); }
133  inline void glMultMatrix(const float* mat) { glMultMatrixf(static_cast<const GLfloat*>(mat)); }
134 
135  #ifdef OSG_GLES1_AVAILABLE
136  inline void glLoadMatrix(const double* mat)
137  {
138  GLfloat flt_mat[16];
139  for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
140  glLoadMatrixf(flt_mat);
141  }
142 
143  inline void glMultMatrix(const double* mat)
144  {
145  GLfloat flt_mat[16];
146  for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
147  glMultMatrixf(flt_mat);
148  }
149 
150  #else
151  inline void glLoadMatrix(const double* mat) { glLoadMatrixd(static_cast<const GLdouble*>(mat)); }
152  inline void glMultMatrix(const double* mat) { glMultMatrixd(static_cast<const GLdouble*>(mat)); }
153  #endif
154 #endif
155 
156 // add defines for OpenGL targets that don't define them, just to ease compatibility across targets
157 #ifndef GL_DOUBLE
158  #define GL_DOUBLE 0x140A
159  typedef double GLdouble;
160 #endif
161 
162 #ifndef GL_INT
163  #define GL_INT 0x1404
164 #endif
165 
166 #ifndef GL_UNSIGNED_INT
167  #define GL_UNSIGNED_INT 0x1405
168 #endif
169 
170 #ifndef GL_NONE
171  // OpenGL ES1 doesn't provide GL_NONE
172  #define GL_NONE 0x0
173 #endif
174 
175 #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
176  //GLES defines (OES)
177  #define GL_RGB8_OES 0x8051
178  #define GL_RGBA8_OES 0x8058
179 #endif
180 
181 #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE)
182  #define GL_POLYGON 0x0009
183  #define GL_QUADS 0x0007
184  #define GL_QUAD_STRIP 0x0008
185 #endif
186 
187 #if defined(OSG_GL3_AVAILABLE)
188  #define GL_LUMINANCE 0x1909
189  #define GL_LUMINANCE_ALPHA 0x190A
190 #endif
191 
192 
193 #endif
double GLdouble
Definition: GL.h:159
void glLoadMatrix(const float *mat)
Definition: GL.h:132
void glMultMatrix(const float *mat)
Definition: GL.h:133