source: trunk/VUT/work/ogre_changes/RenderSystems/GL/include/OgreGLPrerequisites.h @ 115

Revision 115, 12.2 KB checked in by mattausch, 19 years ago (diff)

added depth pass algorithm + delayed transparent object rendering (so depth ordering is right)

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#   include <OpenGL/gl.h>
55#   include <OpenGL/glu.h>
56#endif
57#include "GL/glext.h"
58
59extern "C" {
60// Pointer to glActiveTextureARB function
61typedef void (APIENTRY *GL_ActiveTextureARB_Func)(GLenum);
62extern GL_ActiveTextureARB_Func glActiveTextureARB_ptr;
63
64// Pointer to glClientActiveTextureARB function
65typedef void (APIENTRY *GL_ClientActiveTextureARB_Func)(GLenum);
66extern GL_ClientActiveTextureARB_Func glClientActiveTextureARB_ptr;
67
68// Pointer to glSecondaryColorPointerEXT function
69typedef void (APIENTRY *GL_SecondaryColorPointerEXT_Func)(GLint, GLenum, GLsizei, const GLvoid*);
70extern GL_SecondaryColorPointerEXT_Func glSecondaryColorPointerEXT_ptr;
71
72// Pointer to glSecondaryColor3fEXT function
73typedef void (APIENTRY *GL_SecondaryColor3fEXT_Func)(GLfloat, GLfloat, GLfloat);
74extern GL_SecondaryColor3fEXT_Func glSecondaryColor3fEXT_ptr;
75
76// Pointer to glGenBuffersARB function
77typedef void (APIENTRY *GL_GenBuffersARB_Func)(GLsizei, GLuint*);
78extern GL_GenBuffersARB_Func glGenBuffersARB_ptr;
79
80// Pointer to glBindBufferARB function
81typedef void (APIENTRY *GL_BindBufferARB_Func)(GLenum, GLuint);
82extern GL_BindBufferARB_Func glBindBufferARB_ptr;
83
84// Pointer to glDeleteBuffersARB function
85typedef void (APIENTRY *GL_DeleteBuffersARB_Func)(GLsizei, const GLuint*);
86extern GL_DeleteBuffersARB_Func glDeleteBuffersARB_ptr;
87
88// Pointer to glMapBufferARB function
89typedef GLvoid* (APIENTRY *GL_MapBufferARB_Func)(GLenum, GLenum);
90extern GL_MapBufferARB_Func glMapBufferARB_ptr;
91
92// Pointer to glUnmapBufferARB function
93typedef GLboolean (APIENTRY *GL_UnmapBufferARB_Func)(GLenum);
94extern GL_UnmapBufferARB_Func glUnmapBufferARB_ptr;
95
96// Pointer to glBufferSubDataARB function
97typedef void (APIENTRY *GL_BufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid*);
98extern GL_BufferSubDataARB_Func glBufferSubDataARB_ptr;
99
100// Pointer to glBufferDataARB function
101typedef void (APIENTRY *GL_BufferDataARB_Func)(GLenum, GLsizeiptrARB, const GLvoid* , GLenum);
102extern GL_BufferDataARB_Func glBufferDataARB_ptr;
103
104// Pointer to glGetBufferSubDataARB function
105typedef void (APIENTRY *GL_GetBufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid*);
106extern GL_GetBufferSubDataARB_Func glGetBufferSubDataARB_ptr;
107
108// Pointer to glGenProgramsARB function
109typedef void (APIENTRY *GL_GenProgramsARB_Func)(GLsizei, GLuint*);
110extern GL_GenProgramsARB_Func glGenProgramsARB_ptr;
111
112// Pointer to glDeleteProgramsARB function
113typedef void (APIENTRY *GL_DeleteProgramsARB_Func)(GLsizei, const GLuint*);
114extern GL_DeleteProgramsARB_Func glDeleteProgramsARB_ptr;
115
116// Pointer to glBindProgramARB function
117typedef void (APIENTRY *GL_BindProgramARB_Func)(GLenum, GLuint);
118extern GL_BindProgramARB_Func glBindProgramARB_ptr;
119
120// Pointer to glProgramStringARB function
121typedef void (APIENTRY *GL_ProgramStringARB_Func)(GLenum, GLenum, GLsizei, const GLvoid*);
122extern GL_ProgramStringARB_Func glProgramStringARB_ptr;
123
124// Pointer to glProgramLocalParameter4fvARB function
125typedef void (APIENTRY *GL_ProgramLocalParameter4fvARB_Func)(GLenum, GLuint, const GLfloat *);
126extern GL_ProgramLocalParameter4fvARB_Func glProgramLocalParameter4fvARB_ptr;
127
128// Pointer to glProgramParameter4fvNV function
129typedef void (APIENTRY *GL_ProgramParameter4fvNV_Func)(GLenum, GLuint, const GLfloat *);
130extern GL_ProgramParameter4fvNV_Func glProgramParameter4fvNV_ptr;
131
132// Pointer to glVertexAttribPointerARB function
133typedef void (APIENTRY *GL_VertexAttribPointerARB_Func) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
134extern GL_VertexAttribPointerARB_Func glVertexAttribPointerARB_ptr;
135// Pointer to glEnableVertexAttribArrayARB function
136typedef void (APIENTRY *GL_EnableVertexAttribArrayARB_Func) (GLuint);
137extern GL_EnableVertexAttribArrayARB_Func glEnableVertexAttribArrayARB_ptr;
138// Pointer to glDisableVertexAttribArrayARB function
139typedef void (APIENTRY *GL_DisableVertexAttribArrayARB_Func) (GLuint);
140extern GL_DisableVertexAttribArrayARB_Func glDisableVertexAttribArrayARB_ptr;
141
142
143
144// Pointer to glCombinerStageParameterfvNV function
145typedef void (APIENTRY *GL_CombinerStageParameterfvNV_Func)(GLenum, GLenum, const GLfloat *);
146extern GL_CombinerStageParameterfvNV_Func glCombinerStageParameterfvNV_ptr;
147
148// Pointer to glCombinerParameterfvNV function
149typedef void (APIENTRY *GL_CombinerParameterfvNV_Func)(GLenum, const GLfloat *);
150extern GL_CombinerParameterfvNV_Func glCombinerParameterfvNV_ptr;
151
152// Pointer to glCombinerParameteriNV function
153typedef void (APIENTRY *GL_CombinerParameteriNV_Func)(GLenum, GLint);
154extern GL_CombinerParameteriNV_Func glCombinerParameteriNV_ptr;
155
156// Pointer to glCombinerInputNV function
157typedef void (APIENTRY *GL_CombinerInputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
158extern GL_CombinerInputNV_Func glCombinerInputNV_ptr;
159
160// Pointer to glCombinerOutputNV function
161typedef void (APIENTRY *GL_CombinerOutputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
162
163extern GL_CombinerOutputNV_Func glCombinerOutputNV_ptr;
164
165// Pointer to glFinalCombinerInputNV function
166typedef void (APIENTRY *GL_FinalCombinerInputNV_Func)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
167
168extern GL_FinalCombinerInputNV_Func glFinalCombinerInputNV_ptr;
169
170// Pointer to glGetProgramivARB function
171typedef void (APIENTRY *GL_GetProgramivARB_Func)(GLenum, GLenum, GLint *);
172extern GL_GetProgramivARB_Func glGetProgramivARB_ptr;
173
174// Pointer to glLoadProgramNV function
175typedef void (APIENTRY *GL_LoadProgramNV_Func)(GLenum, GLuint, GLsizei, const GLubyte *);
176extern GL_LoadProgramNV_Func glLoadProgramNV_ptr;
177
178// Pointer to glTrackMatrixNV function
179typedef void (APIENTRY *GL_TrackMatrixNV_Func)(GLenum, GLuint, GLenum, GLenum);
180extern GL_TrackMatrixNV_Func glTrackMatrixNV_ptr;
181
182// Pointer to glActiveStencilFaceEXT function
183typedef void (APIENTRY *GL_ActiveStencilFaceEXT_Func)(GLenum);
184extern GL_ActiveStencilFaceEXT_Func glActiveStencilFaceEXT_ptr;
185
186// Pointer to glGenOcclusionQueriesNV function
187typedef void (APIENTRY *GL_GenOcclusionQueriesNV_Func) (GLsizei n, GLuint *ids);
188extern GL_GenOcclusionQueriesNV_Func glGenOcclusionQueriesNV_ptr;
189
190// Pointer to glDeleteOcclusionQueriesNV function
191typedef void (APIENTRY *GL_DeleteOcclusionQueriesNV_Func) (GLsizei n, const GLuint *ids);
192extern GL_DeleteOcclusionQueriesNV_Func glDeleteOcclusionQueriesNV_ptr;
193
194// Pointer to glIsOcclusionQueryNV function
195typedef GLboolean (APIENTRY *GL_IsOcclusionQueryNV_Func) (GLuint id);
196extern GL_IsOcclusionQueryNV_Func glIsOcclusionQueryNV_ptr;
197
198// Pointer to glBeginOcclusionQueryNV function
199typedef void (APIENTRY *GL_BeginOcclusionQueryNV_Func) (GLuint id);
200extern GL_BeginOcclusionQueryNV_Func glBeginOcclusionQueryNV_ptr;
201
202// Pointer to glEndOcclusionQueryNV function
203typedef void (APIENTRY *GL_EndOcclusionQueryNV_Func) (void);
204extern GL_EndOcclusionQueryNV_Func glEndOcclusionQueryNV_ptr;
205
206// Pointer to glGetOcclusionQueryivNV function
207typedef void (APIENTRY *GL_GetOcclusionQueryivNV_Func) (GLuint id, GLenum pname, GLint *params);
208extern GL_GetOcclusionQueryivNV_Func glGetOcclusionQueryivNV_ptr;
209
210// Pointer to glGetOcclusionQueryuivNV function
211typedef void (APIENTRY *GL_GetOcclusionQueryuivNV_Func) (GLuint id, GLenum pname, GLuint *params);
212extern GL_GetOcclusionQueryuivNV_Func glGetOcclusionQueryuivNV_ptr;
213
214extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB_ptr;
215extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB_ptr;
216extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3DARB_ptr;
217extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1DARB_ptr;
218extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2DARB_ptr;
219extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3DARB_ptr;
220extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB_ptr;
221
222};
223
224// Pointer to glGenQueriesARB function
225typedef void (APIENTRY *GL_GenQueriesARB_Func) (GLuint n, GLuint *ids);
226extern GL_GenQueriesARB_Func glGenQueriesARB_ptr;
227
228// Pointer to glDeleteQueriesARB function
229typedef void (APIENTRY *GL_DeleteQueriesARB_Func) (GLuint n, const GLuint *ids);
230extern GL_DeleteQueriesARB_Func glDeleteQueriesARB_ptr;
231
232// Pointer to glBeginQueryARB function
233typedef void (APIENTRY *GL_BeginQueryARB_Func) (GLenum target, GLuint id);
234extern GL_BeginQueryARB_Func glBeginQueryARB_ptr;
235
236// Pointer to glEndQueryARB function
237typedef void (APIENTRY *GL_EndQueryARB_Func) (GLenum target);
238extern GL_EndQueryARB_Func glEndQueryARB_ptr;
239#ifdef GTP_VISIBILITY_MODIFIED_OGRE
240// Pointer to glGetQueryivARB function
241typedef void (APIENTRY *GL_GetQueryivARB_Func) (GLuint id, GLenum pname, GLint *params);
242extern GL_GetQueryivARB_Func glGetQueryivARB_ptr;
243
244// Pointer to glGetQueryObjectivARB function
245typedef void (APIENTRY *GL_GetQueryObjectivARB_Func) (GLuint id, GLenum pname, GLint *params);
246extern GL_GetQueryObjectivARB_Func glGetQueryObjectivARB_ptr;
247#endif // GTP_VISIBILITY_MODIFIED_OGRE
248// Pointer to glGetQueryObjectuivARB function
249typedef void (APIENTRY *GL_GetQueryObjectuivARB_Func) (GLuint id, GLenum pname, GLuint *params);
250extern GL_GetQueryObjectuivARB_Func glGetQueryObjectuivARB_ptr;
251
252
253namespace 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
Note: See TracBrowser for help on using the repository browser.