source: OGRE/trunk/ogrenew/RenderSystems/GL/include/OgreGLPrerequisites.h @ 657

Revision 657, 12.3 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

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