1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 | #ifndef __GLPrerequisites_H__
|
---|
26 | #define __GLPrerequisites_H__
|
---|
27 |
|
---|
28 | #include "OgrePrerequisites.h"
|
---|
29 |
|
---|
30 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
---|
31 | #if !defined( __MINGW32__ )
|
---|
32 | # define NOMINMAX // required to stop windows.h messing up std::min
|
---|
33 | #endif
|
---|
34 | # include <windows.h>
|
---|
35 | # include <wingdi.h>
|
---|
36 | # include <GL/gl.h>
|
---|
37 | # define GL_GLEXT_PROTOTYPES
|
---|
38 | # include "glprocs.h"
|
---|
39 | # include <GL/glu.h>
|
---|
40 | // Windows library does not include glSecondaryColorPointer even though it's standard now
|
---|
41 | # define glSecondaryColorPointer glSecondaryColorPointerEXT
|
---|
42 | #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
---|
43 | // define GL_GLEXT_LEGACY so that Mesa headers won't try to include their own
|
---|
44 | // glext.h file.
|
---|
45 | # define GL_GLEXT_LEGACY
|
---|
46 | # include <GL/gl.h>
|
---|
47 | # include <GL/glu.h>
|
---|
48 | # define GL_GLEXT_PROTOTYPES
|
---|
49 | #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
---|
50 | # define GL_GLEXT_PROTOTYPES
|
---|
51 | # ifndef APIENTRY
|
---|
52 | # define APIENTRY
|
---|
53 | # endif
|
---|
54 | # include <OpenGL/gl.h>
|
---|
55 | # include <OpenGL/glu.h>
|
---|
56 | #endif
|
---|
57 | #include "GL/glext.h"
|
---|
58 |
|
---|
59 | extern "C" {
|
---|
60 | // Pointer to glActiveTextureARB function
|
---|
61 | typedef void (APIENTRY *GL_ActiveTextureARB_Func)(GLenum);
|
---|
62 | extern GL_ActiveTextureARB_Func glActiveTextureARB_ptr;
|
---|
63 |
|
---|
64 | // Pointer to glClientActiveTextureARB function
|
---|
65 | typedef void (APIENTRY *GL_ClientActiveTextureARB_Func)(GLenum);
|
---|
66 | extern GL_ClientActiveTextureARB_Func glClientActiveTextureARB_ptr;
|
---|
67 |
|
---|
68 | // Pointer to glSecondaryColorPointerEXT function
|
---|
69 | typedef void (APIENTRY *GL_SecondaryColorPointerEXT_Func)(GLint, GLenum, GLsizei, const GLvoid*);
|
---|
70 | extern GL_SecondaryColorPointerEXT_Func glSecondaryColorPointerEXT_ptr;
|
---|
71 |
|
---|
72 | // Pointer to glSecondaryColor3fEXT function
|
---|
73 | typedef void (APIENTRY *GL_SecondaryColor3fEXT_Func)(GLfloat, GLfloat, GLfloat);
|
---|
74 | extern GL_SecondaryColor3fEXT_Func glSecondaryColor3fEXT_ptr;
|
---|
75 |
|
---|
76 | // Pointer to glGenBuffersARB function
|
---|
77 | typedef void (APIENTRY *GL_GenBuffersARB_Func)(GLsizei, GLuint*);
|
---|
78 | extern GL_GenBuffersARB_Func glGenBuffersARB_ptr;
|
---|
79 |
|
---|
80 | // Pointer to glBindBufferARB function
|
---|
81 | typedef void (APIENTRY *GL_BindBufferARB_Func)(GLenum, GLuint);
|
---|
82 | extern GL_BindBufferARB_Func glBindBufferARB_ptr;
|
---|
83 |
|
---|
84 | // Pointer to glDeleteBuffersARB function
|
---|
85 | typedef void (APIENTRY *GL_DeleteBuffersARB_Func)(GLsizei, const GLuint*);
|
---|
86 | extern GL_DeleteBuffersARB_Func glDeleteBuffersARB_ptr;
|
---|
87 |
|
---|
88 | // Pointer to glMapBufferARB function
|
---|
89 | typedef GLvoid* (APIENTRY *GL_MapBufferARB_Func)(GLenum, GLenum);
|
---|
90 | extern GL_MapBufferARB_Func glMapBufferARB_ptr;
|
---|
91 |
|
---|
92 | // Pointer to glUnmapBufferARB function
|
---|
93 | typedef GLboolean (APIENTRY *GL_UnmapBufferARB_Func)(GLenum);
|
---|
94 | extern GL_UnmapBufferARB_Func glUnmapBufferARB_ptr;
|
---|
95 |
|
---|
96 | // Pointer to glBufferSubDataARB function
|
---|
97 | typedef void (APIENTRY *GL_BufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid*);
|
---|
98 | extern GL_BufferSubDataARB_Func glBufferSubDataARB_ptr;
|
---|
99 |
|
---|
100 | // Pointer to glBufferDataARB function
|
---|
101 | typedef void (APIENTRY *GL_BufferDataARB_Func)(GLenum, GLsizeiptrARB, const GLvoid* , GLenum);
|
---|
102 | extern GL_BufferDataARB_Func glBufferDataARB_ptr;
|
---|
103 |
|
---|
104 | // Pointer to glGetBufferSubDataARB function
|
---|
105 | typedef void (APIENTRY *GL_GetBufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid*);
|
---|
106 | extern GL_GetBufferSubDataARB_Func glGetBufferSubDataARB_ptr;
|
---|
107 |
|
---|
108 | // Pointer to glGenProgramsARB function
|
---|
109 | typedef void (APIENTRY *GL_GenProgramsARB_Func)(GLsizei, GLuint*);
|
---|
110 | extern GL_GenProgramsARB_Func glGenProgramsARB_ptr;
|
---|
111 |
|
---|
112 | // Pointer to glDeleteProgramsARB function
|
---|
113 | typedef void (APIENTRY *GL_DeleteProgramsARB_Func)(GLsizei, const GLuint*);
|
---|
114 | extern GL_DeleteProgramsARB_Func glDeleteProgramsARB_ptr;
|
---|
115 |
|
---|
116 | // Pointer to glBindProgramARB function
|
---|
117 | typedef void (APIENTRY *GL_BindProgramARB_Func)(GLenum, GLuint);
|
---|
118 | extern GL_BindProgramARB_Func glBindProgramARB_ptr;
|
---|
119 |
|
---|
120 | // Pointer to glProgramStringARB function
|
---|
121 | typedef void (APIENTRY *GL_ProgramStringARB_Func)(GLenum, GLenum, GLsizei, const GLvoid*);
|
---|
122 | extern GL_ProgramStringARB_Func glProgramStringARB_ptr;
|
---|
123 |
|
---|
124 | // Pointer to glProgramLocalParameter4fvARB function
|
---|
125 | typedef void (APIENTRY *GL_ProgramLocalParameter4fvARB_Func)(GLenum, GLuint, const GLfloat *);
|
---|
126 | extern GL_ProgramLocalParameter4fvARB_Func glProgramLocalParameter4fvARB_ptr;
|
---|
127 |
|
---|
128 | // Pointer to glProgramParameter4fvNV function
|
---|
129 | typedef void (APIENTRY *GL_ProgramParameter4fvNV_Func)(GLenum, GLuint, const GLfloat *);
|
---|
130 | extern GL_ProgramParameter4fvNV_Func glProgramParameter4fvNV_ptr;
|
---|
131 |
|
---|
132 | // Pointer to glVertexAttribPointerARB function
|
---|
133 | typedef void (APIENTRY *GL_VertexAttribPointerARB_Func) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
|
---|
134 | extern GL_VertexAttribPointerARB_Func glVertexAttribPointerARB_ptr;
|
---|
135 | // Pointer to glEnableVertexAttribArrayARB function
|
---|
136 | typedef void (APIENTRY *GL_EnableVertexAttribArrayARB_Func) (GLuint);
|
---|
137 | extern GL_EnableVertexAttribArrayARB_Func glEnableVertexAttribArrayARB_ptr;
|
---|
138 | // Pointer to glDisableVertexAttribArrayARB function
|
---|
139 | typedef void (APIENTRY *GL_DisableVertexAttribArrayARB_Func) (GLuint);
|
---|
140 | extern GL_DisableVertexAttribArrayARB_Func glDisableVertexAttribArrayARB_ptr;
|
---|
141 |
|
---|
142 |
|
---|
143 |
|
---|
144 | // Pointer to glCombinerStageParameterfvNV function
|
---|
145 | typedef void (APIENTRY *GL_CombinerStageParameterfvNV_Func)(GLenum, GLenum, const GLfloat *);
|
---|
146 | extern GL_CombinerStageParameterfvNV_Func glCombinerStageParameterfvNV_ptr;
|
---|
147 |
|
---|
148 | // Pointer to glCombinerParameterfvNV function
|
---|
149 | typedef void (APIENTRY *GL_CombinerParameterfvNV_Func)(GLenum, const GLfloat *);
|
---|
150 | extern GL_CombinerParameterfvNV_Func glCombinerParameterfvNV_ptr;
|
---|
151 |
|
---|
152 | // Pointer to glCombinerParameteriNV function
|
---|
153 | typedef void (APIENTRY *GL_CombinerParameteriNV_Func)(GLenum, GLint);
|
---|
154 | extern GL_CombinerParameteriNV_Func glCombinerParameteriNV_ptr;
|
---|
155 |
|
---|
156 | // Pointer to glCombinerInputNV function
|
---|
157 | typedef void (APIENTRY *GL_CombinerInputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
|
---|
158 | extern GL_CombinerInputNV_Func glCombinerInputNV_ptr;
|
---|
159 |
|
---|
160 | // Pointer to glCombinerOutputNV function
|
---|
161 | typedef void (APIENTRY *GL_CombinerOutputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
|
---|
162 |
|
---|
163 | extern GL_CombinerOutputNV_Func glCombinerOutputNV_ptr;
|
---|
164 |
|
---|
165 | // Pointer to glFinalCombinerInputNV function
|
---|
166 | typedef void (APIENTRY *GL_FinalCombinerInputNV_Func)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
|
---|
167 |
|
---|
168 | extern GL_FinalCombinerInputNV_Func glFinalCombinerInputNV_ptr;
|
---|
169 |
|
---|
170 | // Pointer to glGetProgramivARB function
|
---|
171 | typedef void (APIENTRY *GL_GetProgramivARB_Func)(GLenum, GLenum, GLint *);
|
---|
172 | extern GL_GetProgramivARB_Func glGetProgramivARB_ptr;
|
---|
173 |
|
---|
174 | // Pointer to glLoadProgramNV function
|
---|
175 | typedef void (APIENTRY *GL_LoadProgramNV_Func)(GLenum, GLuint, GLsizei, const GLubyte *);
|
---|
176 | extern GL_LoadProgramNV_Func glLoadProgramNV_ptr;
|
---|
177 |
|
---|
178 | // Pointer to glTrackMatrixNV function
|
---|
179 | typedef void (APIENTRY *GL_TrackMatrixNV_Func)(GLenum, GLuint, GLenum, GLenum);
|
---|
180 | extern GL_TrackMatrixNV_Func glTrackMatrixNV_ptr;
|
---|
181 |
|
---|
182 | // Pointer to glActiveStencilFaceEXT function
|
---|
183 | typedef void (APIENTRY *GL_ActiveStencilFaceEXT_Func)(GLenum);
|
---|
184 | extern GL_ActiveStencilFaceEXT_Func glActiveStencilFaceEXT_ptr;
|
---|
185 |
|
---|
186 | // Pointer to glGenOcclusionQueriesNV function
|
---|
187 | typedef void (APIENTRY *GL_GenOcclusionQueriesNV_Func) (GLsizei n, GLuint *ids);
|
---|
188 | extern GL_GenOcclusionQueriesNV_Func glGenOcclusionQueriesNV_ptr;
|
---|
189 |
|
---|
190 | // Pointer to glDeleteOcclusionQueriesNV function
|
---|
191 | typedef void (APIENTRY *GL_DeleteOcclusionQueriesNV_Func) (GLsizei n, const GLuint *ids);
|
---|
192 | extern GL_DeleteOcclusionQueriesNV_Func glDeleteOcclusionQueriesNV_ptr;
|
---|
193 |
|
---|
194 | // Pointer to glIsOcclusionQueryNV function
|
---|
195 | typedef GLboolean (APIENTRY *GL_IsOcclusionQueryNV_Func) (GLuint id);
|
---|
196 | extern GL_IsOcclusionQueryNV_Func glIsOcclusionQueryNV_ptr;
|
---|
197 |
|
---|
198 | // Pointer to glBeginOcclusionQueryNV function
|
---|
199 | typedef void (APIENTRY *GL_BeginOcclusionQueryNV_Func) (GLuint id);
|
---|
200 | extern GL_BeginOcclusionQueryNV_Func glBeginOcclusionQueryNV_ptr;
|
---|
201 |
|
---|
202 | // Pointer to glEndOcclusionQueryNV function
|
---|
203 | typedef void (APIENTRY *GL_EndOcclusionQueryNV_Func) (void);
|
---|
204 | extern GL_EndOcclusionQueryNV_Func glEndOcclusionQueryNV_ptr;
|
---|
205 |
|
---|
206 | // Pointer to glGetOcclusionQueryivNV function
|
---|
207 | typedef void (APIENTRY *GL_GetOcclusionQueryivNV_Func) (GLuint id, GLenum pname, GLint *params);
|
---|
208 | extern GL_GetOcclusionQueryivNV_Func glGetOcclusionQueryivNV_ptr;
|
---|
209 |
|
---|
210 | // Pointer to glGetOcclusionQueryuivNV function
|
---|
211 | typedef void (APIENTRY *GL_GetOcclusionQueryuivNV_Func) (GLuint id, GLenum pname, GLuint *params);
|
---|
212 | extern GL_GetOcclusionQueryuivNV_Func glGetOcclusionQueryuivNV_ptr;
|
---|
213 |
|
---|
214 | extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB_ptr;
|
---|
215 | extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB_ptr;
|
---|
216 | extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3DARB_ptr;
|
---|
217 | extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1DARB_ptr;
|
---|
218 | extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2DARB_ptr;
|
---|
219 | extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3DARB_ptr;
|
---|
220 | extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB_ptr;
|
---|
221 |
|
---|
222 | };
|
---|
223 |
|
---|
224 | // Pointer to glGenQueriesARB function
|
---|
225 | typedef void (APIENTRY *GL_GenQueriesARB_Func) (GLuint n, GLuint *ids);
|
---|
226 | extern GL_GenQueriesARB_Func glGenQueriesARB_ptr;
|
---|
227 |
|
---|
228 | // Pointer to glDeleteQueriesARB function
|
---|
229 | typedef void (APIENTRY *GL_DeleteQueriesARB_Func) (GLuint n, const GLuint *ids);
|
---|
230 | extern GL_DeleteQueriesARB_Func glDeleteQueriesARB_ptr;
|
---|
231 |
|
---|
232 | // Pointer to glBeginQueryARB function
|
---|
233 | typedef void (APIENTRY *GL_BeginQueryARB_Func) (GLenum target, GLuint id);
|
---|
234 | extern GL_BeginQueryARB_Func glBeginQueryARB_ptr;
|
---|
235 |
|
---|
236 | // Pointer to glEndQueryARB function
|
---|
237 | typedef void (APIENTRY *GL_EndQueryARB_Func) (GLenum target);
|
---|
238 | extern GL_EndQueryARB_Func glEndQueryARB_ptr;
|
---|
239 | #ifdef GTP_VISIBILITY_MODIFIED_OGRE
|
---|
240 | // Pointer to glGetQueryivARB function
|
---|
241 | typedef void (APIENTRY *GL_GetQueryivARB_Func) (GLuint id, GLenum pname, GLint *params);
|
---|
242 | extern GL_GetQueryivARB_Func glGetQueryivARB_ptr;
|
---|
243 |
|
---|
244 | // Pointer to glGetQueryObjectivARB function
|
---|
245 | typedef void (APIENTRY *GL_GetQueryObjectivARB_Func) (GLuint id, GLenum pname, GLint *params);
|
---|
246 | extern GL_GetQueryObjectivARB_Func glGetQueryObjectivARB_ptr;
|
---|
247 | #endif // GTP_VISIBILITY_MODIFIED_OGRE
|
---|
248 | // Pointer to glGetQueryObjectuivARB function
|
---|
249 | typedef void (APIENTRY *GL_GetQueryObjectuivARB_Func) (GLuint id, GLenum pname, GLuint *params);
|
---|
250 | extern GL_GetQueryObjectuivARB_Func glGetQueryObjectuivARB_ptr;
|
---|
251 |
|
---|
252 |
|
---|
253 | namespace Ogre {
|
---|
254 | // Forward declarations
|
---|
255 | class GLSupport;
|
---|
256 | class GLRenderSystem;
|
---|
257 | class GLTexture;
|
---|
258 | class GLTextureManager;
|
---|
259 | class GLGpuProgram;
|
---|
260 | class GLContext;
|
---|
261 | }
|
---|
262 |
|
---|
263 |
|
---|
264 | #ifdef OGRE_DEBUG_MODE
|
---|
265 |
|
---|
266 | #ifndef GL_ERROR_EXCEPT
|
---|
267 |
|
---|
268 | #define OGRE_GL_GETERROR(ERROR_MSG) {const GLubyte *errString; \
|
---|
269 | GLenum errCode = glGetError(); \
|
---|
270 | if (errCode != GL_NO_ERROR) { \
|
---|
271 | errString = gluErrorString (errCode); \
|
---|
272 | LogManager::getSingleton().logMessage ("[GL] :" + ERROR_MSG + \
|
---|
273 | " : " + Ogre::String( (const char*) errString)); \
|
---|
274 | } \
|
---|
275 | }
|
---|
276 |
|
---|
277 | #else //GL_ERROR_EXCEPT
|
---|
278 |
|
---|
279 | #define OGRE_GL_GETERROR(ERROR_MSG) {const GLubyte *errString; \
|
---|
280 | GLenum errCode = glGetError(); \
|
---|
281 | if (errCode != GL_NO_ERROR) { \
|
---|
282 | errString = gluErrorString (errCode); \
|
---|
283 | OGRE_EXCEPT (Exception::ERR_INTERNAL_ERROR, \
|
---|
284 | ERROR_MSG + \
|
---|
285 | " : " + Ogre::String( (const char*) errString), String("")); \
|
---|
286 | } \
|
---|
287 | }
|
---|
288 |
|
---|
289 | #endif //GL_ERROR_EXCEPT
|
---|
290 |
|
---|
291 | #else //OGRE_DEBUG_MODE
|
---|
292 |
|
---|
293 | #define OGRE_GL_GETERROR()
|
---|
294 |
|
---|
295 | #endif //OGRE_DEBUG_MODE
|
---|
296 |
|
---|
297 | #endif
|
---|