OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGL3PlusPrerequisites.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __GL3PlusPrerequisites_H__
29 #define __GL3PlusPrerequisites_H__
30 
31 #include "OgrePrerequisites.h"
32 
33 namespace Ogre {
34  // Forward declarations
35  class GL3PlusSupport;
36  class GL3PlusRenderSystem;
37  class GL3PlusTexture;
38  class GL3PlusTextureManager;
39  class GL3PlusGpuProgram;
40  class GL3PlusContext;
41  class GL3PlusRTTManager;
42  class GL3PlusFBOManager;
43  class GL3PlusHardwarePixelBuffer;
44  class GL3PlusRenderBuffer;
46 
49 }
50 
51 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
52 #if !defined( __MINGW32__ )
53 # define WIN32_LEAN_AND_MEAN
54 # ifndef NOMINMAX
55 # define NOMINMAX // required to stop windows.h messing up std::min
56 # endif
57 #endif
58 # define WGL_WGLEXT_PROTOTYPES
59 # include <windows.h>
60 # include <wingdi.h>
61 # include <GL/gl3w.h>
62 # include <GL/glext.h>
63 # include <GL/wglext.h>
64 #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
65 # define GL_GLEXT_PROTOTYPES
66 # define GLX_GLXEXT_PROTOTYPES
67 
68 # include <X11/Xlib.h>
69 # include <GL/gl3w.h>
70 # include <GL/glext.h>
71 # include <GL/glx.h>
72 # include <GL/glxext.h>
73 # include <GL/glu.h>
74 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
75 # include <GL/gl3w.h>
76 # include <OpenGL/gl3ext.h>
77 #endif
78 
79 // Lots of generated code in here which triggers the new VC CRT security warnings
80 #if !defined( _CRT_SECURE_NO_DEPRECATE )
81 #define _CRT_SECURE_NO_DEPRECATE
82 #endif
83 
84 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(__MINGW32__) && !defined(OGRE_STATIC_LIB)
85 # ifdef RenderSystem_GL3Plus_EXPORTS
86 # define _OgreGL3PlusExport __declspec(dllexport)
87 # else
88 # if defined( __MINGW32__ )
89 # define _OgreGL3PlusExport
90 # else
91 # define _OgreGL3PlusExport __declspec(dllimport)
92 # endif
93 # endif
94 #elif defined ( OGRE_GCC_VISIBILITY )
95 # define _OgreGL3PlusExport __attribute__ ((visibility("default")))
96 #else
97 # define _OgreGL3PlusExport
98 #endif
99 
100 // Convenience macro from ARB_vertex_buffer_object spec
101 #define GL_BUFFER_OFFSET(i) ((char *)NULL + (i))
102 
103 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
104 # define __PRETTY_FUNCTION__ __FUNCTION__
105 #endif
106 
107 #define ENABLE_GL_CHECK 0
108 #if ENABLE_GL_CHECK
109 #define OGRE_CHECK_GL_ERROR(glFunc) \
110 { \
111  glFunc; \
112  int e = glGetError(); \
113  if (e != 0) \
114  { \
115  const char * errorString = ""; \
116  switch(e) \
117  { \
118  case GL_INVALID_ENUM: errorString = "GL_INVALID_ENUM"; break; \
119  case GL_INVALID_VALUE: errorString = "GL_INVALID_VALUE"; break; \
120  case GL_INVALID_OPERATION: errorString = "GL_INVALID_OPERATION"; break; \
121  case GL_INVALID_FRAMEBUFFER_OPERATION: errorString = "GL_INVALID_FRAMEBUFFER_OPERATION"; break; \
122  case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \
123  default: break; \
124  } \
125  char msgBuf[4096]; \
126  StringVector tokens = StringUtil::split(#glFunc, "("); \
127  sprintf(msgBuf, "OpenGL error 0x%04X %s in %s at line %i for %s\n", e, errorString, __PRETTY_FUNCTION__, __LINE__, tokens[0].c_str()); \
128  LogManager::getSingleton().logMessage(msgBuf, LML_CRITICAL); \
129  } \
130 }
131 #else
132 # define OGRE_CHECK_GL_ERROR(glFunc) { glFunc; }
133 #endif
134 
135 #endif //#ifndef __GL3PlusPrerequisites_H__
SharedPtr< GL3PlusTexture > GL3PlusTexturePtr
SharedPtr< GL3PlusGpuProgram > GL3PlusGpuProgramPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.