Crazy Eddie's GUI System  0.8.4
StateChangeWrapper.h
00001 /***********************************************************************
00002     created:    Wed, 8th Feb 2012
00003     author:     Lukas E Meindl
00004 *************************************************************************/
00005 /***************************************************************************
00006  *   Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
00007  *
00008  *   Permission is hereby granted, free of charge, to any person obtaining
00009  *   a copy of this software and associated documentation files (the
00010  *   "Software"), to deal in the Software without restriction, including
00011  *   without limitation the rights to use, copy, modify, merge, publish,
00012  *   distribute, sublicense, and/or sell copies of the Software, and to
00013  *   permit persons to whom the Software is furnished to do so, subject to
00014  *   the following conditions:
00015  *
00016  *   The above copyright notice and this permission notice shall be
00017  *   included in all copies or substantial portions of the Software.
00018  *
00019  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00020  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00022  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00023  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00024  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00025  *   OTHER DEALINGS IN THE SOFTWARE.
00026  ***************************************************************************/
00027 
00028 #ifndef _CEGUIOpenGL3StateChangeWrapper_h_
00029 #define _CEGUIOpenGL3StateChangeWrapper_h_
00030 
00031 #include "CEGUI/RendererModules/OpenGL/GL.h"
00032 #include "CEGUI/RendererModules/OpenGL/GL3Renderer.h"
00033 
00034 #if defined(_MSC_VER)
00035 #   pragma warning(push)
00036 #   pragma warning(disable : 4251)
00037 #endif
00038 
00039 // Start of CEGUI namespace section
00040 namespace CEGUI
00041 {
00042 
00047     class OPENGL_GUIRENDERER_API OpenGL3StateChangeWrapper :
00048         public AllocatedObject<OpenGL3StateChangeWrapper>
00049     {
00050     protected:
00051         struct BlendFuncParams
00052         {
00053             BlendFuncParams();
00054             void reset();
00055             bool equal(GLenum sFactor, GLenum dFactor);
00056             GLenum d_sFactor, d_dFactor;
00057         };
00058         struct BlendFuncSeperateParams
00059         {
00060             BlendFuncSeperateParams();
00061             void reset();
00062             bool equal(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
00063             GLenum d_sfactorRGB, d_dfactorRGB, d_sfactorAlpha, d_dfactorAlpha;
00064         };
00065         struct PortParams
00066         {
00067             PortParams();
00068             void reset();
00069             bool equal(GLint x, GLint y, GLsizei width, GLsizei height);
00070             GLint d_x, d_y;
00071             GLsizei d_width, d_height;
00072         };
00073         struct BindBufferParams
00074         {
00075             BindBufferParams();
00076             void reset();
00077             bool equal(GLenum target, GLuint buffer);
00078             GLenum d_target;
00079             GLuint d_buffer;
00080         };
00081 
00082     public:
00084     OpenGL3StateChangeWrapper(OpenGL3Renderer& owner);
00086     virtual ~OpenGL3StateChangeWrapper();
00087 
00088     void reset();
00089 
00090     void bindVertexArray(GLuint vertexArray);
00091     void blendFunc(GLenum sfactor, GLenum dfactor);
00092     void blendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
00093     void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
00094     void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
00095     void bindBuffer(GLenum target, GLuint buffer);
00096 
00097 protected:
00098     GLuint                      d_vertexArrayObject;
00099     BlendFuncParams             d_blendFuncParams;
00100     BlendFuncSeperateParams     d_blendFuncSeperateParams;
00101     PortParams                  d_viewPortParams;
00102     PortParams                  d_scissorParams;
00103     BindBufferParams            d_bindBufferParams;
00104 };
00105 
00106 } // End of  CEGUI namespace section
00107 
00108 #if defined(_MSC_VER)
00109 #   pragma warning(pop)
00110 #endif
00111 
00112 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends