Crazy Eddie's GUI System  0.8.7
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 
54 class OPENGL_GUIRENDERER_API OpenGL3Renderer : public OpenGLRendererBase
55 {
56 public:
76  static OpenGL3Renderer& bootstrapSystem(const int abi = CEGUI_VERSION_ABI);
77 
100  static OpenGL3Renderer& bootstrapSystem(const Sizef& display_size,
101  const int abi = CEGUI_VERSION_ABI);
102 
118  static void destroySystem();
119 
131  static OpenGL3Renderer& create(const int abi = CEGUI_VERSION_ABI);
132 
147  static OpenGL3Renderer& create(const Sizef& display_size,
148  const int abi = CEGUI_VERSION_ABI);
149 
157  static void destroy(OpenGL3Renderer& renderer);
158 
168 
178 
179 
190 
191 
201 
211 
221 
222  // base class overrides / abstract function implementations
224  void endRendering();
226  bool isS3TCSupported() const;
228  const bool force = false);
229 
230 private:
232  OpenGLGeometryBufferBase* createGeometryBuffer_impl();
233  TextureTarget* createTextureTarget_impl();
234 
235  void initialiseRendererIDString();
236 
241  OpenGL3Renderer();
242 
250  OpenGL3Renderer(const Sizef& display_size);
251 
252  void init();
253 
254  void initialiseOpenGLShaders();
255 
256 protected:
261  virtual ~OpenGL3Renderer();
262 
263 private:
265  void initialiseTextureTargetFactory();
266 
268  void setupExtraStates();
269 
271  OpenGL3Shader* d_shaderStandard;
273  GLint d_shaderStandardPosLoc;
275  GLint d_shaderStandardTexCoordLoc;
277  GLint d_shaderStandardColourLoc;
279  GLint d_shaderStandardMatrixLoc;
281  OpenGL3StateChangeWrapper* d_openGLStateChanger;
283  OpenGL3ShaderManager* d_shaderManager;
285  bool d_s3tcSupported;
287  OGLTextureTargetFactory* d_textureTargetFactory;
288 };
289 
290 }
291 
292 #endif
293 
Definition: RendererBase.h:311
Renderer class to interface with desktop OpenGL version >= 3.2 or OpenGL ES version >= 2.
Definition: GL3Renderer.h:55
GLint getShaderStandardTexCoordLoc()
Helper to return the attribute location of the texture coordinate variable in the standard shader.
bool isS3TCSupported() const
OpenGL3Shader *& getShaderStandard()
Helper to return the reference to the pointer to the standard shader of the Renderer.
GLint getShaderStandardColourLoc()
Helper to return the attribute location of the colour variable in the standard shader.
static OpenGL3Renderer & create(const Sizef &display_size, const int abi=CEGUI_VERSION_ABI)
Create an OpenGL3Renderer object.
GLint getShaderStandardMatrixUniformLoc()
Helper to return the uniform location of the matrix variable in the standard shader.
static OpenGL3Renderer & bootstrapSystem(const int abi=CEGUI_VERSION_ABI)
Convenience function that creates the required objects to initialise the CEGUI system.
void beginRendering()
Perform any operations required to put the system into a state ready for rendering operations to begi...
virtual ~OpenGL3Renderer()
Destructor for OpenGL3Renderer objects.
static void destroy(OpenGL3Renderer &renderer)
Destroy an OpenGL3Renderer object.
GLint getShaderStandardPositionLoc()
Helper to return the attribute location of the position variable in the standard shader.
void setupRenderingBlendMode(const BlendMode mode, const bool force=false)
set the render states for the specified BlendMode.
Sizef getAdjustedTextureSize(const Sizef &sz) const
Helper to return a valid texture size according to reported OpenGL capabilities.
static void destroySystem()
Convenience function to cleanup the CEGUI system and related objects that were created by calling the...
OpenGL3StateChangeWrapper * getOpenGLStateChanger()
Helper to get the wrapper used to check for redundant OpenGL state changes.
static OpenGL3Renderer & create(const int abi=CEGUI_VERSION_ABI)
Create an OpenGL3Renderer object.
void endRendering()
Perform any operations required to finalise rendering.
static OpenGL3Renderer & bootstrapSystem(const Sizef &display_size, const int abi=CEGUI_VERSION_ABI)
Convenience function that creates the required objects to initialise the CEGUI system.
Definition: ShaderManager.h:56
Definition: Shader.h:45
OpenGL3StateChangeWrapper - wraps OpenGL calls and checks for redundant calls beforehand.
Definition: StateChangeWrapper.h:49
OpenGL based implementation of the GeometryBuffer interface.
Definition: GeometryBufferBase.h:53
Common base class used for other OpenGL (desktop or ES) based renderer modules.
Definition: RendererBase.h:54
Specialisation of RenderTarget interface that should be used as the base class for RenderTargets that...
Definition: TextureTarget.h:41
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
BlendMode
Enumerated type that contains the valid options that specify the type of blending that is to be perfo...
Definition: Renderer.h:62