OgreGLESPrerequisites.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) 2008 Renato Araujo Oliveira Filho <renatox@gmail.com>
00008 Copyright (c) 2000-2012 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_SYMBIAN)
00037 #   undef _WIN32
00038 #endif
00039 
00040 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
00041 #   if !defined( __MINGW32__ )
00042 #       ifndef WIN32_LEAN_AND_MEAN
00043 #           define WIN32_LEAN_AND_MEAN 1
00044 #       endif
00045 #       ifndef NOMINMAX
00046 #           define NOMINMAX // required to stop windows.h messing up std::min
00047 #       endif
00048 #   endif
00049 #endif
00050 
00051 #if (OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS)
00052 #   include <OpenGLES/ES1/gl.h>
00053 #   include <OpenGLES/ES1/glext.h>
00054 #   ifdef __OBJC__
00055 #       include <OpenGLES/EAGL.h>
00056 #   endif
00057 #   ifndef GL_GLEXT_PROTOTYPES
00058 #       define  GL_GLEXT_PROTOTYPES
00059 #   endif
00060 #else
00061 #   include <GLES/gl.h>
00062 #   include <GLES/glext.h>
00063 #   include <GLES/egl.h>
00064 
00065 // If we are going to use the PVRTC_CODEC make sure we
00066 // setup the needed constants
00067 #if (OGRE_NO_PVRTC_CODEC == 0)
00068 #   ifndef GL_IMG_texture_compression_pvrtc
00069 #       define GL_IMG_texture_compression_pvrtc 1
00070 #       define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG                      0x8C00
00071 #       define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG                      0x8C01
00072 #       define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG                     0x8C02
00073 #       define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG                     0x8C03
00074 #   endif
00075 #endif
00076 
00077 // Function pointers for FBO extension methods
00078 // Declare them here since we don't have GLEW to do it for us
00079 
00080 #   ifndef GL_GLEXT_PROTOTYPES
00081 extern PFNGLISRENDERBUFFEROESPROC glIsRenderbufferOES;
00082 extern PFNGLBINDRENDERBUFFEROESPROC glBindRenderbufferOES;
00083 extern PFNGLDELETERENDERBUFFERSOESPROC glDeleteRenderbuffersOES;
00084 extern PFNGLGENRENDERBUFFERSOESPROC glGenRenderbuffersOES;
00085 extern PFNGLRENDERBUFFERSTORAGEOESPROC glRenderbufferStorageOES;
00086 extern PFNGLGETRENDERBUFFERPARAMETERIVOESPROC glGetRenderbufferParameterivOES;
00087 extern PFNGLISFRAMEBUFFEROESPROC glIsFramebufferOES;
00088 extern PFNGLBINDFRAMEBUFFEROESPROC glBindFramebufferOES;
00089 extern PFNGLDELETEFRAMEBUFFERSOESPROC glDeleteFramebuffersOES;
00090 extern PFNGLGENFRAMEBUFFERSOESPROC glGenFramebuffersOES;
00091 extern PFNGLCHECKFRAMEBUFFERSTATUSOESPROC glCheckFramebufferStatusOES;
00092 extern PFNGLFRAMEBUFFERRENDERBUFFEROESPROC glFramebufferRenderbufferOES;
00093 extern PFNGLFRAMEBUFFERTEXTURE2DOESPROC glFramebufferTexture2DOES;
00094 extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC glGetFramebufferAttachmentParameterivOES;
00095 extern PFNGLGENERATEMIPMAPOESPROC glGenerateMipmapOES;
00096 extern PFNGLBLENDEQUATIONOESPROC glBlendEquationOES;
00097 extern PFNGLBLENDFUNCSEPARATEOESPROC glBlendFuncSeparateOES;
00098 extern PFNGLBLENDEQUATIONSEPARATEOESPROC glBlendEquationSeparateOES;
00099 extern PFNGLMAPBUFFEROESPROC glMapBufferOES;
00100 extern PFNGLUNMAPBUFFEROESPROC glUnmapBufferOES;
00101 #   endif
00102 
00103 #endif
00104 
00105 // Define GL_NONE for convenience
00106 #define GL_NONE 0
00107 
00108 #ifndef GL_BGRA
00109 #   define GL_BGRA  0x80E1
00110 #endif
00111 
00112 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(__MINGW32__) && !defined(OGRE_STATIC_LIB)
00113 #   ifdef OGRE_GLESPLUGIN_EXPORTS
00114 #       define _OgreGLESExport __declspec(dllexport)
00115 #   else
00116 #       if defined( __MINGW32__ )
00117 #           define _OgreGLESExport
00118 #       else
00119 #           define _OgreGLESExport __declspec(dllimport)
00120 #       endif
00121 #   endif
00122 #elif defined ( OGRE_GCC_VISIBILITY )
00123 #    define _OgreGLESExport  __attribute__ ((visibility("default")))
00124 #else
00125 #    define _OgreGLESExport
00126 #endif
00127 
00128 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
00129 #define __PRETTY_FUNCTION__ __FUNCTION__
00130 #endif
00131 
00132 
00133 #define DEBUG_(text) \
00134     {\
00135         fprintf(stderr, "%s:%d: %s\n", __FUNCTION__, __LINE__, text); \
00136     }
00137 
00138 #define ENABLE_GL_CHECK 0
00139 #if ENABLE_GL_CHECK
00140 #define GL_CHECK_ERROR \
00141     { \
00142         int e = glGetError(); \
00143         if (e != 0) \
00144         { \
00145             fprintf(stderr, "OpenGL error 0x%04X in %s at line %i in %s\n", e, __PRETTY_FUNCTION__, __LINE__, __FILE__); \
00146         } \
00147     }
00148 #else
00149     #define GL_CHECK_ERROR {}
00150 #endif
00151 
00152 
00153 #if ENABLE_GL_CHECK
00154     #define EGL_CHECK_ERROR \
00155     { \
00156         int e = eglGetError(); \
00157         if ((e != 0) && (e != EGL_SUCCESS))\
00158         { \
00159             fprintf(stderr, "OpenGL error 0x%04X in %s at line %i in %s\n", e, __PRETTY_FUNCTION__, __LINE__, __FILE__); \
00160             assert(false); \
00161         } \
00162     }
00163 #else
00164     #define EGL_CHECK_ERROR {}
00165 #endif
00166 
00167 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 2012 21:48:50