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