Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
GL3Renderer.h
1 /***********************************************************************
2  created: Wed, 8th Feb 2012
3  author: Lukas E Meindl (based on code by Paul D Turner)
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIOpenGL3Renderer_h_
28 #define _CEGUIOpenGL3Renderer_h_
29 
30 #include "RendererBase.h"
31 
32 namespace CEGUI
33 {
34  class OpenGL3Shader;
35  class OpenGL3ShaderManager;
36  class OpenGL3StateChangeWrapper;
37 
42 class OPENGL_GUIRENDERER_API OpenGL3Renderer : public OpenGLRendererBase
43 {
44 public:
64  static OpenGL3Renderer& bootstrapSystem(const int abi = CEGUI_VERSION_ABI);
65 
88  static OpenGL3Renderer& bootstrapSystem(const Sizef& display_size,
89  const int abi = CEGUI_VERSION_ABI);
90 
106  static void destroySystem();
107 
119  static OpenGL3Renderer& create(const int abi = CEGUI_VERSION_ABI);
120 
135  static OpenGL3Renderer& create(const Sizef& display_size,
136  const int abi = CEGUI_VERSION_ABI);
137 
145  static void destroy(OpenGL3Renderer& renderer);
146 
155  OpenGL3Shader*& getShaderStandard();
156 
165  GLint getShaderStandardPositionLoc();
166 
167 
177  GLint getShaderStandardTexCoordLoc();
178 
179 
188  GLint getShaderStandardColourLoc();
189 
198  GLint getShaderStandardMatrixUniformLoc();
199 
208  OpenGL3StateChangeWrapper* getOpenGLStateChanger();
209 
210  // base class overrides / abstract function implementations
211  void beginRendering();
212  void endRendering();
213  Sizef getAdjustedTextureSize(const Sizef& sz) const;
214  bool isS3TCSupported() const;
215  void setupRenderingBlendMode(const BlendMode mode,
216  const bool force = false);
217 
218 private:
219  OpenGLGeometryBufferBase* createGeometryBuffer_impl();
220  TextureTarget* createTextureTarget_impl();
221 
222  void initialiseRendererIDString();
223 
232  OpenGL3Renderer();
233 
245  OpenGL3Renderer(const Sizef& display_size);
246 
247  void initialiseOpenGLShaders();
248  void initialiseGLExtensions();
249 
254  virtual ~OpenGL3Renderer();
255 
257  void initialiseTextureTargetFactory();
258 
260  void setupExtraStates();
261 
263  OpenGL3Shader* d_shaderStandard;
265  GLint d_shaderStandardPosLoc;
267  GLint d_shaderStandardTexCoordLoc;
269  GLint d_shaderStandardColourLoc;
271  GLint d_shaderStandardMatrixLoc;
273  OpenGL3StateChangeWrapper* d_openGLStateChanger;
274  OpenGL3ShaderManager* d_shaderManager;
276  bool d_s3tcSupported;
278  OGLTextureTargetFactory* d_textureTargetFactory;
279 };
280 
281 }
282 
283 #endif
284