Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreGLPrerequisites.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2005 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef __GLPrerequisites_H__
00026 #define __GLPrerequisites_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 
00030 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
00031 #if !defined( __MINGW32__ )
00032 #   define NOMINMAX // required to stop windows.h messing up std::min
00033 #endif
00034 #   include <windows.h>
00035 #   include <wingdi.h>
00036 #   include <GL/gl.h>
00037 #   define GL_GLEXT_PROTOTYPES
00038 #   include "glprocs.h"
00039 #   include <GL/glu.h>
00040 // Windows library does not include glSecondaryColorPointer even though it's standard now
00041 #   define glSecondaryColorPointer glSecondaryColorPointerEXT
00042 #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
00043 // define GL_GLEXT_LEGACY so that Mesa headers won't try to include their own
00044 // glext.h file.
00045 #   define GL_GLEXT_LEGACY
00046 #   include <GL/gl.h>
00047 #   include <GL/glu.h>
00048 #   define GL_GLEXT_PROTOTYPES
00049 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00050 #   define GL_GLEXT_PROTOTYPES
00051 #   ifndef APIENTRY
00052 #       define APIENTRY
00053 #   endif
00054 #   include <OpenGL/gl.h>
00055 #   include <OpenGL/glu.h>
00056 #endif
00057 #include "GL/glext.h"
00058 
00059 extern "C" {
00060 // Pointer to glActiveTextureARB function
00061 typedef void (APIENTRY *GL_ActiveTextureARB_Func)(GLenum);
00062 extern GL_ActiveTextureARB_Func glActiveTextureARB_ptr;
00063 
00064 // Pointer to glClientActiveTextureARB function
00065 typedef void (APIENTRY *GL_ClientActiveTextureARB_Func)(GLenum);
00066 extern GL_ClientActiveTextureARB_Func glClientActiveTextureARB_ptr;
00067 
00068 // Pointer to glSecondaryColorPointerEXT function
00069 typedef void (APIENTRY *GL_SecondaryColorPointerEXT_Func)(GLint, GLenum, GLsizei, const GLvoid*);
00070 extern GL_SecondaryColorPointerEXT_Func glSecondaryColorPointerEXT_ptr;
00071 
00072 // Pointer to glSecondaryColor3fEXT function
00073 typedef void (APIENTRY *GL_SecondaryColor3fEXT_Func)(GLfloat, GLfloat, GLfloat);
00074 extern GL_SecondaryColor3fEXT_Func glSecondaryColor3fEXT_ptr;
00075 
00076 // Pointer to glGenBuffersARB function
00077 typedef void (APIENTRY *GL_GenBuffersARB_Func)(GLsizei, GLuint*);
00078 extern GL_GenBuffersARB_Func glGenBuffersARB_ptr;
00079 
00080 // Pointer to glBindBufferARB function
00081 typedef void (APIENTRY *GL_BindBufferARB_Func)(GLenum, GLuint);
00082 extern GL_BindBufferARB_Func glBindBufferARB_ptr;
00083 
00084 // Pointer to glDeleteBuffersARB function
00085 typedef void (APIENTRY *GL_DeleteBuffersARB_Func)(GLsizei, const GLuint*);
00086 extern GL_DeleteBuffersARB_Func glDeleteBuffersARB_ptr;
00087 
00088 // Pointer to glMapBufferARB function
00089 typedef GLvoid* (APIENTRY *GL_MapBufferARB_Func)(GLenum, GLenum);
00090 extern GL_MapBufferARB_Func glMapBufferARB_ptr;
00091 
00092 // Pointer to glUnmapBufferARB function
00093 typedef GLboolean (APIENTRY *GL_UnmapBufferARB_Func)(GLenum);
00094 extern GL_UnmapBufferARB_Func glUnmapBufferARB_ptr;
00095 
00096 // Pointer to glBufferSubDataARB function
00097 typedef void (APIENTRY *GL_BufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid*);
00098 extern GL_BufferSubDataARB_Func glBufferSubDataARB_ptr;
00099 
00100 // Pointer to glBufferDataARB function
00101 typedef void (APIENTRY *GL_BufferDataARB_Func)(GLenum, GLsizeiptrARB, const GLvoid* , GLenum);
00102 extern GL_BufferDataARB_Func glBufferDataARB_ptr;
00103 
00104 // Pointer to glGetBufferSubDataARB function
00105 typedef void (APIENTRY *GL_GetBufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid*);
00106 extern GL_GetBufferSubDataARB_Func glGetBufferSubDataARB_ptr;
00107 
00108 // Pointer to glGenProgramsARB function
00109 typedef void (APIENTRY *GL_GenProgramsARB_Func)(GLsizei, GLuint*);
00110 extern GL_GenProgramsARB_Func glGenProgramsARB_ptr;
00111 
00112 // Pointer to glDeleteProgramsARB function
00113 typedef void (APIENTRY *GL_DeleteProgramsARB_Func)(GLsizei, const GLuint*);
00114 extern GL_DeleteProgramsARB_Func glDeleteProgramsARB_ptr;
00115 
00116 // Pointer to glBindProgramARB function
00117 typedef void (APIENTRY *GL_BindProgramARB_Func)(GLenum, GLuint);
00118 extern GL_BindProgramARB_Func glBindProgramARB_ptr;
00119 
00120 // Pointer to glProgramStringARB function
00121 typedef void (APIENTRY *GL_ProgramStringARB_Func)(GLenum, GLenum, GLsizei, const GLvoid*);
00122 extern GL_ProgramStringARB_Func glProgramStringARB_ptr;
00123 
00124 // Pointer to glProgramLocalParameter4fvARB function
00125 typedef void (APIENTRY *GL_ProgramLocalParameter4fvARB_Func)(GLenum, GLuint, const GLfloat *);
00126 extern GL_ProgramLocalParameter4fvARB_Func glProgramLocalParameter4fvARB_ptr;
00127 
00128 // Pointer to glProgramParameter4fvNV function
00129 typedef void (APIENTRY *GL_ProgramParameter4fvNV_Func)(GLenum, GLuint, const GLfloat *);
00130 extern GL_ProgramParameter4fvNV_Func glProgramParameter4fvNV_ptr;
00131 
00132 // Pointer to glVertexAttribPointerARB function
00133 typedef void (APIENTRY *GL_VertexAttribPointerARB_Func) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
00134 extern GL_VertexAttribPointerARB_Func glVertexAttribPointerARB_ptr;
00135 // Pointer to glEnableVertexAttribArrayARB function
00136 typedef void (APIENTRY *GL_EnableVertexAttribArrayARB_Func) (GLuint);
00137 extern GL_EnableVertexAttribArrayARB_Func glEnableVertexAttribArrayARB_ptr;
00138 // Pointer to glDisableVertexAttribArrayARB function
00139 typedef void (APIENTRY *GL_DisableVertexAttribArrayARB_Func) (GLuint);
00140 extern GL_DisableVertexAttribArrayARB_Func glDisableVertexAttribArrayARB_ptr;
00141 
00142 
00143 
00144 // Pointer to glCombinerStageParameterfvNV function
00145 typedef void (APIENTRY *GL_CombinerStageParameterfvNV_Func)(GLenum, GLenum, const GLfloat *);
00146 extern GL_CombinerStageParameterfvNV_Func glCombinerStageParameterfvNV_ptr;
00147 
00148 // Pointer to glCombinerParameterfvNV function
00149 typedef void (APIENTRY *GL_CombinerParameterfvNV_Func)(GLenum, const GLfloat *);
00150 extern GL_CombinerParameterfvNV_Func glCombinerParameterfvNV_ptr;
00151 
00152 // Pointer to glCombinerParameteriNV function
00153 typedef void (APIENTRY *GL_CombinerParameteriNV_Func)(GLenum, GLint);
00154 extern GL_CombinerParameteriNV_Func glCombinerParameteriNV_ptr;
00155 
00156 // Pointer to glCombinerInputNV function
00157 typedef void (APIENTRY *GL_CombinerInputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
00158 extern GL_CombinerInputNV_Func glCombinerInputNV_ptr;
00159 
00160 // Pointer to glCombinerOutputNV function
00161 typedef void (APIENTRY *GL_CombinerOutputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
00162 
00163 extern GL_CombinerOutputNV_Func glCombinerOutputNV_ptr;
00164 
00165 // Pointer to glFinalCombinerInputNV function
00166 typedef void (APIENTRY *GL_FinalCombinerInputNV_Func)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
00167 
00168 extern GL_FinalCombinerInputNV_Func glFinalCombinerInputNV_ptr;
00169 
00170 // Pointer to glGetProgramivARB function
00171 typedef void (APIENTRY *GL_GetProgramivARB_Func)(GLenum, GLenum, GLint *);
00172 extern GL_GetProgramivARB_Func glGetProgramivARB_ptr;
00173 
00174 // Pointer to glLoadProgramNV function
00175 typedef void (APIENTRY *GL_LoadProgramNV_Func)(GLenum, GLuint, GLsizei, const GLubyte *);
00176 extern GL_LoadProgramNV_Func glLoadProgramNV_ptr;
00177 
00178 // Pointer to glTrackMatrixNV function
00179 typedef void (APIENTRY *GL_TrackMatrixNV_Func)(GLenum, GLuint, GLenum, GLenum);
00180 extern GL_TrackMatrixNV_Func glTrackMatrixNV_ptr;
00181 
00182 // Pointer to glActiveStencilFaceEXT function
00183 typedef void (APIENTRY *GL_ActiveStencilFaceEXT_Func)(GLenum);
00184 extern GL_ActiveStencilFaceEXT_Func glActiveStencilFaceEXT_ptr;
00185 
00186 // Pointer to glGenOcclusionQueriesNV function
00187 typedef void (APIENTRY *GL_GenOcclusionQueriesNV_Func) (GLsizei n, GLuint *ids);
00188 extern GL_GenOcclusionQueriesNV_Func glGenOcclusionQueriesNV_ptr;
00189 
00190 // Pointer to glDeleteOcclusionQueriesNV function
00191 typedef void (APIENTRY *GL_DeleteOcclusionQueriesNV_Func) (GLsizei n, const GLuint *ids);
00192 extern GL_DeleteOcclusionQueriesNV_Func glDeleteOcclusionQueriesNV_ptr;
00193 
00194 // Pointer to glIsOcclusionQueryNV function
00195 typedef GLboolean (APIENTRY *GL_IsOcclusionQueryNV_Func) (GLuint id);
00196 extern GL_IsOcclusionQueryNV_Func glIsOcclusionQueryNV_ptr;
00197 
00198 // Pointer to glBeginOcclusionQueryNV function
00199 typedef void (APIENTRY *GL_BeginOcclusionQueryNV_Func) (GLuint id);
00200 extern GL_BeginOcclusionQueryNV_Func glBeginOcclusionQueryNV_ptr;
00201 
00202 // Pointer to glEndOcclusionQueryNV function
00203 typedef void (APIENTRY *GL_EndOcclusionQueryNV_Func) (void);
00204 extern GL_EndOcclusionQueryNV_Func glEndOcclusionQueryNV_ptr;
00205 
00206 // Pointer to glGetOcclusionQueryivNV function
00207 typedef void (APIENTRY *GL_GetOcclusionQueryivNV_Func) (GLuint id, GLenum pname, GLint *params);
00208 extern GL_GetOcclusionQueryivNV_Func glGetOcclusionQueryivNV_ptr;
00209 
00210 // Pointer to glGetOcclusionQueryuivNV function
00211 typedef void (APIENTRY *GL_GetOcclusionQueryuivNV_Func) (GLuint id, GLenum pname, GLuint *params);
00212 extern GL_GetOcclusionQueryuivNV_Func glGetOcclusionQueryuivNV_ptr;
00213 
00214 extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB_ptr;
00215 extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB_ptr;
00216 extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3DARB_ptr;
00217 extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1DARB_ptr;
00218 extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2DARB_ptr;
00219 extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3DARB_ptr;
00220 extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB_ptr;
00221 
00222 };
00223 
00224 // Pointer to glGenQueriesARB function
00225 typedef void (APIENTRY *GL_GenQueriesARB_Func) (GLuint n, GLuint *ids);
00226 extern GL_GenQueriesARB_Func glGenQueriesARB_ptr;
00227 
00228 // Pointer to glDeleteQueriesARB function
00229 typedef void (APIENTRY *GL_DeleteQueriesARB_Func) (GLuint n, const GLuint *ids);
00230 extern GL_DeleteQueriesARB_Func glDeleteQueriesARB_ptr;
00231 
00232 // Pointer to glBeginQueryARB function
00233 typedef void (APIENTRY *GL_BeginQueryARB_Func) (GLenum target, GLuint id);
00234 extern GL_BeginQueryARB_Func glBeginQueryARB_ptr;
00235 
00236 // Pointer to glEndQueryARB function
00237 typedef void (APIENTRY *GL_EndQueryARB_Func) (GLenum target);
00238 extern GL_EndQueryARB_Func glEndQueryARB_ptr;
00239 
00240 // Pointer to glGetQueryObjectuivARB function
00241 typedef void (APIENTRY *GL_GetQueryObjectuivARB_Func) (GLuint id, GLenum pname, GLuint *params);
00242 extern GL_GetQueryObjectuivARB_Func glGetQueryObjectuivARB_ptr;
00243 
00244 
00245 namespace Ogre {
00246     // Forward declarations
00247     class GLSupport;
00248     class GLRenderSystem;
00249     class GLTexture;
00250     class GLTextureManager;
00251     class GLGpuProgram;
00252     class GLContext;
00253 }
00254 
00255 
00256 #ifdef  OGRE_DEBUG_MODE
00257 
00258 #ifndef GL_ERROR_EXCEPT
00259 
00260 #define OGRE_GL_GETERROR(ERROR_MSG) {const GLubyte *errString; \
00261     GLenum errCode = glGetError(); \
00262     if (errCode != GL_NO_ERROR) {  \
00263     errString = gluErrorString (errCode);  \
00264     LogManager::getSingleton().logMessage  ("[GL] :" + ERROR_MSG +  \
00265     " : " + Ogre::String( (const char*) errString)); \
00266         } \
00267     }
00268 
00269 #else //GL_ERROR_EXCEPT
00270 
00271 #define OGRE_GL_GETERROR(ERROR_MSG) {const GLubyte *errString; \
00272     GLenum errCode = glGetError(); \
00273     if (errCode != GL_NO_ERROR) {  \
00274     errString = gluErrorString (errCode);  \
00275     OGRE_EXCEPT (Exception::ERR_INTERNAL_ERROR,  \
00276     ERROR_MSG +  \
00277     " : " + Ogre::String( (const char*) errString), String("")); \
00278         } \
00279     }
00280 
00281 #endif //GL_ERROR_EXCEPT
00282 
00283 #else //OGRE_DEBUG_MODE
00284 
00285 #define OGRE_GL_GETERROR()
00286 
00287 #endif //OGRE_DEBUG_MODE
00288 
00289 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Apr 10 23:21:15 2005