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