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