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 #   define GL_GLEXT_LEGACY 
00055 #   include <OpenGL/gl.h>
00056 #   include <OpenGL/glu.h>
00057 #endif
00058 #include "GL/glext.h"
00059 
00060 extern "C" {
00061 // Pointer to glActiveTextureARB function
00062 typedef void (APIENTRY *GL_ActiveTextureARB_Func)(GLenum);
00063 extern GL_ActiveTextureARB_Func glActiveTextureARB_ptr;
00064 
00065 // Pointer to glClientActiveTextureARB function
00066 typedef void (APIENTRY *GL_ClientActiveTextureARB_Func)(GLenum);
00067 extern GL_ClientActiveTextureARB_Func glClientActiveTextureARB_ptr;
00068 
00069 // Pointer to glSecondaryColorPointerEXT function
00070 typedef void (APIENTRY *GL_SecondaryColorPointerEXT_Func)(GLint, GLenum, GLsizei, const GLvoid*);
00071 extern GL_SecondaryColorPointerEXT_Func glSecondaryColorPointerEXT_ptr;
00072 
00073 // Pointer to glSecondaryColor3fEXT function
00074 typedef void (APIENTRY *GL_SecondaryColor3fEXT_Func)(GLfloat, GLfloat, GLfloat);
00075 extern GL_SecondaryColor3fEXT_Func glSecondaryColor3fEXT_ptr;
00076 
00077 // Pointer to glGenBuffersARB function
00078 typedef void (APIENTRY *GL_GenBuffersARB_Func)(GLsizei, GLuint*);
00079 extern GL_GenBuffersARB_Func glGenBuffersARB_ptr;
00080 
00081 // Pointer to glBindBufferARB function
00082 typedef void (APIENTRY *GL_BindBufferARB_Func)(GLenum, GLuint);
00083 extern GL_BindBufferARB_Func glBindBufferARB_ptr;
00084 
00085 // Pointer to glDeleteBuffersARB function
00086 typedef void (APIENTRY *GL_DeleteBuffersARB_Func)(GLsizei, const GLuint*);
00087 extern GL_DeleteBuffersARB_Func glDeleteBuffersARB_ptr;
00088 
00089 // Pointer to glMapBufferARB function
00090 typedef GLvoid* (APIENTRY *GL_MapBufferARB_Func)(GLenum, GLenum);
00091 extern GL_MapBufferARB_Func glMapBufferARB_ptr;
00092 
00093 // Pointer to glUnmapBufferARB function
00094 typedef GLboolean (APIENTRY *GL_UnmapBufferARB_Func)(GLenum);
00095 extern GL_UnmapBufferARB_Func glUnmapBufferARB_ptr;
00096 
00097 // Pointer to glBufferSubDataARB function
00098 typedef void (APIENTRY *GL_BufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid*);
00099 extern GL_BufferSubDataARB_Func glBufferSubDataARB_ptr;
00100 
00101 // Pointer to glBufferDataARB function
00102 typedef void (APIENTRY *GL_BufferDataARB_Func)(GLenum, GLsizeiptrARB, const GLvoid* , GLenum);
00103 extern GL_BufferDataARB_Func glBufferDataARB_ptr;
00104 
00105 // Pointer to glGetBufferSubDataARB function
00106 typedef void (APIENTRY *GL_GetBufferSubDataARB_Func)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid*);
00107 extern GL_GetBufferSubDataARB_Func glGetBufferSubDataARB_ptr;
00108 
00109 // Pointer to glGenProgramsARB function
00110 typedef void (APIENTRY *GL_GenProgramsARB_Func)(GLsizei, GLuint*);
00111 extern GL_GenProgramsARB_Func glGenProgramsARB_ptr;
00112 
00113 // Pointer to glDeleteProgramsARB function
00114 typedef void (APIENTRY *GL_DeleteProgramsARB_Func)(GLsizei, const GLuint*);
00115 extern GL_DeleteProgramsARB_Func glDeleteProgramsARB_ptr;
00116 
00117 // Pointer to glBindProgramARB function
00118 typedef void (APIENTRY *GL_BindProgramARB_Func)(GLenum, GLuint);
00119 extern GL_BindProgramARB_Func glBindProgramARB_ptr;
00120 
00121 // Pointer to glProgramStringARB function
00122 typedef void (APIENTRY *GL_ProgramStringARB_Func)(GLenum, GLenum, GLsizei, const GLvoid*);
00123 extern GL_ProgramStringARB_Func glProgramStringARB_ptr;
00124 
00125 // Pointer to glProgramLocalParameter4fvARB function
00126 typedef void (APIENTRY *GL_ProgramLocalParameter4fvARB_Func)(GLenum, GLuint, const GLfloat *);
00127 extern GL_ProgramLocalParameter4fvARB_Func glProgramLocalParameter4fvARB_ptr;
00128 
00129 // Pointer to glProgramParameter4fvNV function
00130 typedef void (APIENTRY *GL_ProgramParameter4fvNV_Func)(GLenum, GLuint, const GLfloat *);
00131 extern GL_ProgramParameter4fvNV_Func glProgramParameter4fvNV_ptr;
00132 
00133 // Pointer to glVertexAttribPointerARB function
00134 typedef void (APIENTRY *GL_VertexAttribPointerARB_Func) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
00135 extern GL_VertexAttribPointerARB_Func glVertexAttribPointerARB_ptr;
00136 // Pointer to glEnableVertexAttribArrayARB function
00137 typedef void (APIENTRY *GL_EnableVertexAttribArrayARB_Func) (GLuint);
00138 extern GL_EnableVertexAttribArrayARB_Func glEnableVertexAttribArrayARB_ptr;
00139 // Pointer to glDisableVertexAttribArrayARB function
00140 typedef void (APIENTRY *GL_DisableVertexAttribArrayARB_Func) (GLuint);
00141 extern GL_DisableVertexAttribArrayARB_Func glDisableVertexAttribArrayARB_ptr;
00142 
00143 
00144 
00145 // Pointer to glCombinerStageParameterfvNV function
00146 typedef void (APIENTRY *GL_CombinerStageParameterfvNV_Func)(GLenum, GLenum, const GLfloat *);
00147 extern GL_CombinerStageParameterfvNV_Func glCombinerStageParameterfvNV_ptr;
00148 
00149 // Pointer to glCombinerParameterfvNV function
00150 typedef void (APIENTRY *GL_CombinerParameterfvNV_Func)(GLenum, const GLfloat *);
00151 extern GL_CombinerParameterfvNV_Func glCombinerParameterfvNV_ptr;
00152 
00153 // Pointer to glCombinerParameteriNV function
00154 typedef void (APIENTRY *GL_CombinerParameteriNV_Func)(GLenum, GLint);
00155 extern GL_CombinerParameteriNV_Func glCombinerParameteriNV_ptr;
00156 
00157 // Pointer to glCombinerInputNV function
00158 typedef void (APIENTRY *GL_CombinerInputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
00159 extern GL_CombinerInputNV_Func glCombinerInputNV_ptr;
00160 
00161 // Pointer to glCombinerOutputNV function
00162 typedef void (APIENTRY *GL_CombinerOutputNV_Func)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
00163 
00164 extern GL_CombinerOutputNV_Func glCombinerOutputNV_ptr;
00165 
00166 // Pointer to glFinalCombinerInputNV function
00167 typedef void (APIENTRY *GL_FinalCombinerInputNV_Func)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
00168 
00169 extern GL_FinalCombinerInputNV_Func glFinalCombinerInputNV_ptr;
00170 
00171 // Pointer to glGetProgramivARB function
00172 typedef void (APIENTRY *GL_GetProgramivARB_Func)(GLenum, GLenum, GLint *);
00173 extern GL_GetProgramivARB_Func glGetProgramivARB_ptr;
00174 
00175 // Pointer to glLoadProgramNV function
00176 typedef void (APIENTRY *GL_LoadProgramNV_Func)(GLenum, GLuint, GLsizei, const GLubyte *);
00177 extern GL_LoadProgramNV_Func glLoadProgramNV_ptr;
00178 
00179 // Pointer to glTrackMatrixNV function
00180 typedef void (APIENTRY *GL_TrackMatrixNV_Func)(GLenum, GLuint, GLenum, GLenum);
00181 extern GL_TrackMatrixNV_Func glTrackMatrixNV_ptr;
00182 
00183 // Pointer to glActiveStencilFaceEXT function
00184 typedef void (APIENTRY *GL_ActiveStencilFaceEXT_Func)(GLenum);
00185 extern GL_ActiveStencilFaceEXT_Func glActiveStencilFaceEXT_ptr;
00186 
00187 // Pointer to glGenOcclusionQueriesNV function
00188 typedef void (APIENTRY *GL_GenOcclusionQueriesNV_Func) (GLsizei n, GLuint *ids);
00189 extern GL_GenOcclusionQueriesNV_Func glGenOcclusionQueriesNV_ptr;
00190 
00191 // Pointer to glDeleteOcclusionQueriesNV function
00192 typedef void (APIENTRY *GL_DeleteOcclusionQueriesNV_Func) (GLsizei n, const GLuint *ids);
00193 extern GL_DeleteOcclusionQueriesNV_Func glDeleteOcclusionQueriesNV_ptr;
00194 
00195 // Pointer to glIsOcclusionQueryNV function
00196 typedef GLboolean (APIENTRY *GL_IsOcclusionQueryNV_Func) (GLuint id);
00197 extern GL_IsOcclusionQueryNV_Func glIsOcclusionQueryNV_ptr;
00198 
00199 // Pointer to glBeginOcclusionQueryNV function
00200 typedef void (APIENTRY *GL_BeginOcclusionQueryNV_Func) (GLuint id);
00201 extern GL_BeginOcclusionQueryNV_Func glBeginOcclusionQueryNV_ptr;
00202 
00203 // Pointer to glEndOcclusionQueryNV function
00204 typedef void (APIENTRY *GL_EndOcclusionQueryNV_Func) (void);
00205 extern GL_EndOcclusionQueryNV_Func glEndOcclusionQueryNV_ptr;
00206 
00207 // Pointer to glGetOcclusionQueryivNV function
00208 typedef void (APIENTRY *GL_GetOcclusionQueryivNV_Func) (GLuint id, GLenum pname, GLint *params);
00209 extern GL_GetOcclusionQueryivNV_Func glGetOcclusionQueryivNV_ptr;
00210 
00211 // Pointer to glGetOcclusionQueryuivNV function
00212 typedef void (APIENTRY *GL_GetOcclusionQueryuivNV_Func) (GLuint id, GLenum pname, GLuint *params);
00213 extern GL_GetOcclusionQueryuivNV_Func glGetOcclusionQueryuivNV_ptr;
00214 
00215 extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB_ptr;
00216 extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB_ptr;
00217 extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3DARB_ptr;
00218 extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1DARB_ptr;
00219 extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2DARB_ptr;
00220 extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3DARB_ptr;
00221 extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB_ptr;
00222 
00223 };
00224 
00225 // Pointer to glGenQueriesARB function
00226 typedef void (APIENTRY *GL_GenQueriesARB_Func) (GLuint n, GLuint *ids);
00227 extern GL_GenQueriesARB_Func glGenQueriesARB_ptr;
00228 
00229 // Pointer to glDeleteQueriesARB function
00230 typedef void (APIENTRY *GL_DeleteQueriesARB_Func) (GLuint n, const GLuint *ids);
00231 extern GL_DeleteQueriesARB_Func glDeleteQueriesARB_ptr;
00232 
00233 // Pointer to glBeginQueryARB function
00234 typedef void (APIENTRY *GL_BeginQueryARB_Func) (GLenum target, GLuint id);
00235 extern GL_BeginQueryARB_Func glBeginQueryARB_ptr;
00236 
00237 // Pointer to glEndQueryARB function
00238 typedef void (APIENTRY *GL_EndQueryARB_Func) (GLenum target);
00239 extern GL_EndQueryARB_Func glEndQueryARB_ptr;
00240 
00241 // Pointer to glGetQueryObjectuivARB function
00242 typedef void (APIENTRY *GL_GetQueryObjectuivARB_Func) (GLuint id, GLenum pname, GLuint *params);
00243 extern GL_GetQueryObjectuivARB_Func glGetQueryObjectuivARB_ptr;
00244 
00245 
00246 namespace Ogre {
00247     // Forward declarations
00248     class GLSupport;
00249     class GLRenderSystem;
00250     class GLTexture;
00251     class GLTextureManager;
00252     class GLGpuProgram;
00253     class GLContext;
00254 }
00255 
00256 
00257 #ifdef  OGRE_DEBUG_MODE
00258 
00259 #ifndef GL_ERROR_EXCEPT
00260 
00261 #define OGRE_GL_GETERROR(ERROR_MSG) {const GLubyte *errString; \
00262     GLenum errCode = glGetError(); \
00263     if (errCode != GL_NO_ERROR) {  \
00264     errString = gluErrorString (errCode);  \
00265     LogManager::getSingleton().logMessage  ("[GL] :" + Ogre::String(ERROR_MSG) +  \
00266     " : " + Ogre::String( (const char*) errString)); \
00267         } \
00268     }
00269 
00270 #else //GL_ERROR_EXCEPT
00271 
00272 #define OGRE_GL_GETERROR(ERROR_MSG) {const GLubyte *errString; \
00273     GLenum errCode = glGetError(); \
00274     if (errCode != GL_NO_ERROR) {  \
00275     errString = gluErrorString (errCode);  \
00276     OGRE_EXCEPT (Exception::ERR_INTERNAL_ERROR,  \
00277     Ogre::String(ERROR_MSG) +  \
00278     " : " + Ogre::String( (const char*) errString), String("")); \
00279         } \
00280     }
00281 
00282 #endif //GL_ERROR_EXCEPT
00283 
00284 #else //OGRE_DEBUG_MODE
00285 
00286 #define OGRE_GL_GETERROR()
00287 
00288 #endif //OGRE_DEBUG_MODE
00289 
00290 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:45 2006