Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
StateChangeWrapper.h
1 /***********************************************************************
2  filename: StateChangeWrapper.h
3  created: Wed, 8th Feb 2012
4  author: Lukas E Meindl
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 
29 #ifndef _CEGUIOpenGL3StateChangeWrapper_h_
30 #define _CEGUIOpenGL3StateChangeWrapper_h_
31 
32 #include "CEGUI/RendererModules/OpenGL/GL.h"
33 #include "CEGUI/RendererModules/OpenGL/GL3Renderer.h"
34 
35 #if defined(_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
38 #endif
39 
40 // Start of CEGUI namespace section
41 namespace CEGUI
42 {
43 
48  class OPENGL_GUIRENDERER_API OpenGL3StateChangeWrapper :
49  public AllocatedObject<OpenGL3StateChangeWrapper>
50  {
51  protected:
53  {
55  void reset();
56  bool equal(GLenum sFactor, GLenum dFactor);
57  GLenum d_sFactor, d_dFactor;
58  };
60  {
62  void reset();
63  bool equal(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
64  GLenum d_sfactorRGB, d_dfactorRGB, d_sfactorAlpha, d_dfactorAlpha;
65  };
66  struct PortParams
67  {
68  PortParams();
69  void reset();
70  bool equal(GLint x, GLint y, GLsizei width, GLsizei height);
71  GLint d_x, d_y;
72  GLsizei d_width, d_height;
73  };
75  {
77  void reset();
78  bool equal(GLenum target, GLuint buffer);
79  GLenum d_target;
80  GLuint d_buffer;
81  };
82 
83  public:
87  virtual ~OpenGL3StateChangeWrapper();
88 
89  void reset();
90 
91  void bindVertexArray(GLuint vertexArray);
92  void blendFunc(GLenum sfactor, GLenum dfactor);
93  void blendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
94  void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
95  void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
96  void bindBuffer(GLenum target, GLuint buffer);
97 
98 protected:
99  GLuint d_vertexArrayObject;
100  BlendFuncParams d_blendFuncParams;
101  BlendFuncSeperateParams d_blendFuncSeperateParams;
102  PortParams d_viewPortParams;
103  PortParams d_scissorParams;
104  BindBufferParams d_bindBufferParams;
105 };
106 
107 } // End of CEGUI namespace section
108 
109 #if defined(_MSC_VER)
110 # pragma warning(pop)
111 #endif
112 
113 #endif