OGRE  2.0
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 #include "OgreLogManager.h"
34 
35 namespace Ogre {
36  // Forward declarations
37  class GL3PlusSupport;
38  class GL3PlusRenderSystem;
39  class GL3PlusTexture;
40  class GL3PlusTextureManager;
41  class GL3PlusContext;
42  class GL3PlusRTTManager;
43  class GL3PlusFBOManager;
44  class GL3PlusHardwarePixelBuffer;
45  class GL3PlusRenderBuffer;
46  class GL3PlusDepthBuffer;
47 
48  class GLSLShader;
49 
52 }
53 
54 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
55 #if !defined( __MINGW32__ )
56 # define WIN32_LEAN_AND_MEAN
57 # ifndef NOMINMAX
58 # define NOMINMAX // required to stop windows.h messing up std::min
59 # endif
60 #endif
61 # define WGL_WGLEXT_PROTOTYPES
62 # include <windows.h>
63 # include <wingdi.h>
64 # include <GL/gl3w.h>
65 # include <GL/glext.h>
66 # include <GL/wglext.h>
67 #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
68 # define GL_GLEXT_PROTOTYPES
69 # define GLX_GLXEXT_PROTOTYPES
70 
71 # include <X11/Xlib.h>
72 # include <GL/gl3w.h>
73 # include <GL/glext.h>
74 # include <GL/glx.h>
75 # include <GL/glxext.h>
76 # include <GL/glu.h>
77 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
78 # include <GL/gl3w.h>
79 # include <OpenGL/gl3ext.h>
80 #endif
81 
82 // Lots of generated code in here which triggers the new VC CRT security warnings
83 #if !defined( _CRT_SECURE_NO_DEPRECATE )
84 #define _CRT_SECURE_NO_DEPRECATE
85 #endif
86 
87 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(__MINGW32__) && !defined(OGRE_STATIC_LIB)
88 # ifdef RenderSystem_GL3Plus_EXPORTS
89 # define _OgreGL3PlusExport __declspec(dllexport)
90 # else
91 # if defined( __MINGW32__ )
92 # define _OgreGL3PlusExport
93 # else
94 # define _OgreGL3PlusExport __declspec(dllimport)
95 # endif
96 # endif
97 #elif defined ( OGRE_GCC_VISIBILITY )
98 # define _OgreGL3PlusExport __attribute__ ((visibility("default")))
99 #else
100 # define _OgreGL3PlusExport
101 #endif
102 
103 // Convenience macro from ARB_vertex_buffer_object spec
104 #define GL_BUFFER_OFFSET(i) ((char *)NULL + (i))
105 
106 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
107 # define __PRETTY_FUNCTION__ __FUNCTION__
108 #endif
109 
110 #define ENABLE_GL_CHECK 0
111 #if ENABLE_GL_CHECK
112 #include "OgreStringVector.h"
113 #define OGRE_CHECK_GL_ERROR(glFunc) \
114 { \
115  glFunc; \
116  int e = glGetError(); \
117  if (e != 0) \
118  { \
119  const char * errorString = ""; \
120  switch(e) \
121  { \
122  case GL_INVALID_ENUM: errorString = "GL_INVALID_ENUM"; break; \
123  case GL_INVALID_VALUE: errorString = "GL_INVALID_VALUE"; break; \
124  case GL_INVALID_OPERATION: errorString = "GL_INVALID_OPERATION"; break; \
125  case GL_INVALID_FRAMEBUFFER_OPERATION: errorString = "GL_INVALID_FRAMEBUFFER_OPERATION"; break; \
126  case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \
127  default: break; \
128  } \
129  char msgBuf[4096]; \
130  StringVector tokens = StringUtil::split(#glFunc, "("); \
131  sprintf(msgBuf, "OpenGL error 0x%04X %s in %s at line %i for %s\n", e, errorString, __PRETTY_FUNCTION__, __LINE__, tokens[0].c_str()); \
132  LogManager::getSingleton().logMessage(msgBuf, LML_CRITICAL); \
133  } \
134 }
135 #else
136 # define OGRE_CHECK_GL_ERROR(glFunc) { glFunc; }
137 #endif
138 
139 #endif //#ifndef __GL3PlusPrerequisites_H__
SharedPtr< GLSLShader > GLSLShaderPtr
SharedPtr< GL3PlusTexture > GL3PlusTexturePtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Specialisation of HighLevelGpuProgram to encapsulate shader objects obtained from compiled shaders wr...