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-2013 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 #ifndef __GL3PlusPrerequisites_H__ 00029 #define __GL3PlusPrerequisites_H__ 00030 00031 #include "OgrePrerequisites.h" 00032 00033 namespace Ogre { 00034 // Forward declarations 00035 class GL3PlusSupport; 00036 class GL3PlusRenderSystem; 00037 class GL3PlusTexture; 00038 class GL3PlusTextureManager; 00039 class GL3PlusGpuProgram; 00040 class GL3PlusContext; 00041 class GL3PlusRTTManager; 00042 class GL3PlusFBOManager; 00043 class GL3PlusHardwarePixelBuffer; 00044 class GL3PlusRenderBuffer; 00045 class GL3PlusDepthBuffer; 00046 00047 typedef SharedPtr<GL3PlusGpuProgram> GL3PlusGpuProgramPtr; 00048 typedef SharedPtr<GL3PlusTexture> GL3PlusTexturePtr; 00049 } 00050 00051 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 00052 #if !defined( __MINGW32__ ) 00053 # define WIN32_LEAN_AND_MEAN 00054 # ifndef NOMINMAX 00055 # define NOMINMAX // required to stop windows.h messing up std::min 00056 # endif 00057 #endif 00058 # define WGL_WGLEXT_PROTOTYPES 00059 # include <windows.h> 00060 # include <wingdi.h> 00061 # include <GL/gl3w.h> 00062 # include <GL/glext.h> 00063 # include <GL/wglext.h> 00064 #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX 00065 # define GL_GLEXT_PROTOTYPES 00066 # define GLX_GLXEXT_PROTOTYPES 00067 00068 # include <X11/Xlib.h> 00069 # include <GL/gl3w.h> 00070 # include <GL/glext.h> 00071 # include <GL/glx.h> 00072 # include <GL/glxext.h> 00073 # include <GL/glu.h> 00074 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE 00075 # include <GL/gl3w.h> 00076 # include <OpenGL/gl3ext.h> 00077 #endif 00078 00079 // Lots of generated code in here which triggers the new VC CRT security warnings 00080 #if !defined( _CRT_SECURE_NO_DEPRECATE ) 00081 #define _CRT_SECURE_NO_DEPRECATE 00082 #endif 00083 00084 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(__MINGW32__) && !defined(OGRE_STATIC_LIB) 00085 # ifdef RenderSystem_GL3Plus_EXPORTS 00086 # define _OgreGL3PlusExport __declspec(dllexport) 00087 # else 00088 # if defined( __MINGW32__ ) 00089 # define _OgreGL3PlusExport 00090 # else 00091 # define _OgreGL3PlusExport __declspec(dllimport) 00092 # endif 00093 # endif 00094 #elif defined ( OGRE_GCC_VISIBILITY ) 00095 # define _OgreGL3PlusExport __attribute__ ((visibility("default"))) 00096 #else 00097 # define _OgreGL3PlusExport 00098 #endif 00099 00100 // Convenience macro from ARB_vertex_buffer_object spec 00101 #define GL_BUFFER_OFFSET(i) ((char *)NULL + (i)) 00102 00103 #if OGRE_COMPILER == OGRE_COMPILER_MSVC 00104 # define __PRETTY_FUNCTION__ __FUNCTION__ 00105 #endif 00106 00107 #define ENABLE_GL_CHECK 0 00108 #if ENABLE_GL_CHECK 00109 #define OGRE_CHECK_GL_ERROR(glFunc) \ 00110 { \ 00111 glFunc; \ 00112 int e = glGetError(); \ 00113 if (e != 0) \ 00114 { \ 00115 const char * errorString = ""; \ 00116 switch(e) \ 00117 { \ 00118 case GL_INVALID_ENUM: errorString = "GL_INVALID_ENUM"; break; \ 00119 case GL_INVALID_VALUE: errorString = "GL_INVALID_VALUE"; break; \ 00120 case GL_INVALID_OPERATION: errorString = "GL_INVALID_OPERATION"; break; \ 00121 case GL_INVALID_FRAMEBUFFER_OPERATION: errorString = "GL_INVALID_FRAMEBUFFER_OPERATION"; break; \ 00122 case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \ 00123 default: break; \ 00124 } \ 00125 char msgBuf[4096]; \ 00126 StringVector tokens = StringUtil::split(#glFunc, "("); \ 00127 sprintf(msgBuf, "OpenGL error 0x%04X %s in %s at line %i for %s\n", e, errorString, __PRETTY_FUNCTION__, __LINE__, tokens[0].c_str()); \ 00128 LogManager::getSingleton().logMessage(msgBuf, LML_CRITICAL); \ 00129 } \ 00130 } 00131 #else 00132 # define OGRE_CHECK_GL_ERROR(glFunc) { glFunc; } 00133 #endif 00134 00135 #endif //#ifndef __GL3PlusPrerequisites_H__
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