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) 2008 Renato Araujo Oliveira Filho <renatox@gmail.com> 00008 Copyright (c) 2000-2013 Torus Knot Software Ltd 00009 00010 Permission is hereby granted, free of charge, to any person obtaining a copy 00011 of this software and associated documentation files (the "Software"), to deal 00012 in the Software without restriction, including without limitation the rights 00013 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00014 copies of the Software, and to permit persons to whom the Software is 00015 furnished to do so, subject to the following conditions: 00016 00017 The above copyright notice and this permission notice shall be included in 00018 all copies or substantial portions of the Software. 00019 00020 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00021 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00022 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00023 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00024 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00025 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00026 THE SOFTWARE. 00027 ----------------------------------------------------------------------------- 00028 */ 00029 00030 #ifndef __GLESPrerequisites_H__ 00031 #define __GLESPrerequisites_H__ 00032 00033 #include "OgrePrerequisites.h" 00034 #include "OgreMath.h" 00035 00036 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) 00037 # if !defined( __MINGW32__ ) 00038 # ifndef WIN32_LEAN_AND_MEAN 00039 # define WIN32_LEAN_AND_MEAN 1 00040 # endif 00041 # ifndef NOMINMAX 00042 # define NOMINMAX // required to stop windows.h messing up std::min 00043 # endif 00044 # endif 00045 #endif 00046 00047 #if (OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS) 00048 # include <OpenGLES/ES1/gl.h> 00049 # include <OpenGLES/ES1/glext.h> 00050 # ifdef __OBJC__ 00051 # include <OpenGLES/EAGL.h> 00052 # endif 00053 # ifndef GL_GLEXT_PROTOTYPES 00054 # define GL_GLEXT_PROTOTYPES 00055 # endif 00056 #elif (OGRE_PLATFORM == OGRE_PLATFORM_ANDROID) 00057 # ifndef GL_GLEXT_PROTOTYPES 00058 # define GL_GLEXT_PROTOTYPES 00059 # endif 00060 # include <GLES/glplatform.h> 00061 # include <GLES/gl.h> 00062 # include <GLES/glext.h> 00063 # include <EGL/egl.h> 00064 #else 00065 # include <GLES/gl.h> 00066 # include <GLES/glext.h> 00067 # include <GLES/egl.h> 00068 00069 // If we are going to use the PVRTC_CODEC make sure we 00070 // setup the needed constants 00071 #if OGRE_NO_PVRTC_CODEC == 0 00072 # ifndef GL_IMG_texture_compression_pvrtc 00073 # define GL_IMG_texture_compression_pvrtc 1 00074 # define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 00075 # define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 00076 # define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 00077 # define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 00078 # endif 00079 #endif 00080 00081 /* GL_EXT_texture_compression_dxt1 */ 00082 #ifndef GL_EXT_texture_compression_dxt1 00083 # define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 00084 # define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 00085 #endif 00086 00087 // Function pointers for FBO extension methods 00088 // Declare them here since we don't have GLEW to do it for us 00089 00090 # ifndef GL_GLEXT_PROTOTYPES 00091 extern PFNGLISRENDERBUFFEROESPROC glIsRenderbufferOES; 00092 extern PFNGLBINDRENDERBUFFEROESPROC glBindRenderbufferOES; 00093 extern PFNGLDELETERENDERBUFFERSOESPROC glDeleteRenderbuffersOES; 00094 extern PFNGLGENRENDERBUFFERSOESPROC glGenRenderbuffersOES; 00095 extern PFNGLRENDERBUFFERSTORAGEOESPROC glRenderbufferStorageOES; 00096 extern PFNGLGETRENDERBUFFERPARAMETERIVOESPROC glGetRenderbufferParameterivOES; 00097 extern PFNGLISFRAMEBUFFEROESPROC glIsFramebufferOES; 00098 extern PFNGLBINDFRAMEBUFFEROESPROC glBindFramebufferOES; 00099 extern PFNGLDELETEFRAMEBUFFERSOESPROC glDeleteFramebuffersOES; 00100 extern PFNGLGENFRAMEBUFFERSOESPROC glGenFramebuffersOES; 00101 extern PFNGLCHECKFRAMEBUFFERSTATUSOESPROC glCheckFramebufferStatusOES; 00102 extern PFNGLFRAMEBUFFERRENDERBUFFEROESPROC glFramebufferRenderbufferOES; 00103 extern PFNGLFRAMEBUFFERTEXTURE2DOESPROC glFramebufferTexture2DOES; 00104 extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC glGetFramebufferAttachmentParameterivOES; 00105 extern PFNGLGENERATEMIPMAPOESPROC glGenerateMipmapOES; 00106 extern PFNGLBLENDEQUATIONOESPROC glBlendEquationOES; 00107 extern PFNGLBLENDFUNCSEPARATEOESPROC glBlendFuncSeparateOES; 00108 extern PFNGLBLENDEQUATIONSEPARATEOESPROC glBlendEquationSeparateOES; 00109 extern PFNGLMAPBUFFEROESPROC glMapBufferOES; 00110 extern PFNGLUNMAPBUFFEROESPROC glUnmapBufferOES; 00111 # endif 00112 00113 #endif 00114 00115 // Define GL_NONE for convenience 00116 #define GL_NONE 0 00117 00118 #ifndef GL_BGRA 00119 # define GL_BGRA 0x80E1 00120 #endif 00121 00122 // Used for polygon modes 00123 #ifndef GL_FILL 00124 # define GL_FILL 0x1B02 00125 #endif 00126 00127 namespace Ogre { 00128 class GLESTexture; 00129 typedef SharedPtr<GLESTexture> GLESTexturePtr; 00130 }; 00131 00132 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(__MINGW32__) && !defined(OGRE_STATIC_LIB) 00133 # ifdef OGRE_GLESPLUGIN_EXPORTS 00134 # define _OgreGLESExport __declspec(dllexport) 00135 # else 00136 # if defined( __MINGW32__ ) 00137 # define _OgreGLESExport 00138 # else 00139 # define _OgreGLESExport __declspec(dllimport) 00140 # endif 00141 # endif 00142 #elif defined ( OGRE_GCC_VISIBILITY ) 00143 # define _OgreGLESExport __attribute__ ((visibility("default"))) 00144 #else 00145 # define _OgreGLESExport 00146 #endif 00147 00148 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 00149 #define __PRETTY_FUNCTION__ __FUNCTION__ 00150 #endif 00151 00152 00153 #define DEBUG_(text) \ 00154 {\ 00155 fprintf(stderr, "%s:%d: %s\n", __FUNCTION__, __LINE__, text); \ 00156 } 00157 00158 #define ENABLE_GL_CHECK 0 00159 00160 #if ENABLE_GL_CHECK 00161 #define GL_CHECK_ERROR \ 00162 { \ 00163 int e = glGetError(); \ 00164 if (e != 0) \ 00165 { \ 00166 const char * errorString = ""; \ 00167 switch(e) \ 00168 { \ 00169 case GL_INVALID_ENUM: errorString = "GL_INVALID_ENUM"; break; \ 00170 case GL_INVALID_VALUE: errorString = "GL_INVALID_VALUE"; break; \ 00171 case GL_INVALID_OPERATION: errorString = "GL_INVALID_OPERATION"; break; \ 00172 case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \ 00173 default: break; \ 00174 } \ 00175 char msgBuf[1024]; \ 00176 sprintf(msgBuf, "OpenGL ES error 0x%04X %s in %s at line %i in %s \n", e, errorString, __PRETTY_FUNCTION__, __LINE__, __FILE__); \ 00177 LogManager::getSingleton().logMessage(msgBuf); \ 00178 } \ 00179 } 00180 #else 00181 #define GL_CHECK_ERROR {} 00182 #endif 00183 00184 #define ENABLE_EGL_CHECK 1 00185 00186 #if ENABLE_EGL_CHECK 00187 #define EGL_CHECK_ERROR \ 00188 { \ 00189 int e = eglGetError(); \ 00190 if ((e != 0) && (e != EGL_SUCCESS))\ 00191 { \ 00192 char msgBuf[1024]; \ 00193 sprintf(msgBuf, "EGL error 0x%04X in %s at line %i in %s \n", e, __PRETTY_FUNCTION__, __LINE__, __FILE__);\ 00194 LogManager::getSingleton().logMessage(msgBuf);\ 00195 } \ 00196 } 00197 #else 00198 #define EGL_CHECK_ERROR {} 00199 #endif 00200 00201 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:42