Crazy Eddie's GUI System  0.8.7
StateChangeWrapper.h
1 /***********************************************************************
2  created: Wed, 8th Feb 2012
3  author: Lukas E Meindl
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 
28 #ifndef _CEGUIOpenGL3StateChangeWrapper_h_
29 #define _CEGUIOpenGL3StateChangeWrapper_h_
30 
31 #include "CEGUI/RendererModules/OpenGL/GL.h"
32 #include "CEGUI/RendererModules/OpenGL/GL3Renderer.h"
33 
34 #if defined(_MSC_VER)
35 # pragma warning(push)
36 # pragma warning(disable : 4251)
37 #endif
38 
39 // Start of CEGUI namespace section
40 namespace CEGUI
41 {
42 
47  class OPENGL_GUIRENDERER_API OpenGL3StateChangeWrapper :
48  public AllocatedObject<OpenGL3StateChangeWrapper>
49  {
50  protected:
52  {
54  void reset();
55  bool equal(GLenum sFactor, GLenum dFactor);
56  GLenum d_sFactor, d_dFactor;
57  };
59  {
61  void reset();
62  bool equal(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
63  GLenum d_sfactorRGB, d_dfactorRGB, d_sfactorAlpha, d_dfactorAlpha;
64  };
65  struct PortParams
66  {
67  PortParams();
68  void reset();
69  bool equal(GLint x, GLint y, GLsizei width, GLsizei height);
70  GLint d_x, d_y;
71  GLsizei d_width, d_height;
72  };
74  {
76  void reset();
77  bool equal(GLenum target, GLuint buffer);
78  GLenum d_target;
79  GLuint d_buffer;
80  };
81 
82 public:
83 
86  virtual ~OpenGL3StateChangeWrapper();
87 
88  void reset();
89 
90  void bindVertexArray(GLuint vertexArray);
91  void blendFunc(GLenum sfactor, GLenum dfactor);
92  void blendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
93  void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
94  void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
95  void bindBuffer(GLenum target, GLuint buffer);
96 
97 protected:
98  GLuint d_vertexArrayObject;
99  BlendFuncParams d_blendFuncParams;
100  BlendFuncSeperateParams d_blendFuncSeperateParams;
101  PortParams d_viewPortParams;
102  PortParams d_scissorParams;
103  BindBufferParams d_bindBufferParams;
104 };
105 
106 } // End of CEGUI namespace section
107 
108 #if defined(_MSC_VER)
109 # pragma warning(pop)
110 #endif
111 
112 #endif
Definition: MemoryAllocatedObject.h:109
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Definition: StateChangeWrapper.h:65
Definition: StateChangeWrapper.h:51
Renderer class to interface with desktop OpenGL version >= 3.2 or OpenGL ES version >= 2...
Definition: GL3Renderer.h:54
OpenGL3StateChangeWrapper - wraps OpenGL calls and checks for redundant calls beforehand.
Definition: StateChangeWrapper.h:47
Definition: StateChangeWrapper.h:73