OgreGLNullStateCacheManagerImp.h
Go to the documentation of this file.
1 /*
2  -----------------------------------------------------------------------------
3  This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5  For the latest info, see http://www.ogre3d.org/
6 
7  Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9  Permission is hereby granted, free of charge, to any person obtaining a copy
10  of this software and associated documentation files (the "Software"), to deal
11  in the Software without restriction, including without limitation the rights
12  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13  copies of the Software, and to permit persons to whom the Software is
14  furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25  THE SOFTWARE.
26  -----------------------------------------------------------------------------
27  */
28 
29 #ifndef __GLNullStateCacheManagerImp_H__
30 #define __GLNullStateCacheManagerImp_H__
31 
32 #include "OgreGLPrerequisites.h"
33 
35 
36 namespace Ogre
37 {
42  {
43  private:
49  GLboolean mDepthMask;
51  GLenum mPolygonMode;
59  GLenum mCullFace;
61  GLenum mDepthFunc;
63  GLuint mStencilMask;
67  unsigned int mDiscardBuffers;
69  GLclampf mClearDepth;
71  int mViewport[4];
72 
75  GLenum mShadeModel;
76 
77  GLfloat mAmbient[4];
78  GLfloat mDiffuse[4];
79  GLfloat mSpecular[4];
80  GLfloat mEmissive[4];
81  GLfloat mLightAmbient[4];
82  GLfloat mShininess;
83 
84  GLfloat mPointSize;
85  GLfloat mPointSizeMin;
86  GLfloat mPointSizeMax;
87  GLfloat mPointAttenuation[3];
88 
89  public:
92 
94  void initializeCache();
95 
97  void clearCache();
98 
100  void bindGLBuffer(GLenum target, GLuint buffer, bool force = false);
101 
103  void deleteGLBuffer(GLenum target, GLuint buffer, bool force = false);
104 
106  void bindGLTexture(GLenum target, GLuint texture);
107 
109  void setTexParameteri(GLenum target, GLenum pname, GLint param);
110 
112  void invalidateStateForTexture(GLuint texture);
113 
115  bool activateGLTextureUnit(size_t unit);
116 
118  GLenum getBlendEquation(void) const { return mBlendEquation; }
119 
121  void setBlendEquation(GLenum eq);
122 
124  void setBlendEquation(GLenum eqRGB, GLenum eqA);
125 
127  void setBlendFunc(GLenum source, GLenum dest);
128 
130  void setShadeModel(GLenum model);
131 
133  void setLightAmbient(GLfloat r, GLfloat g, GLfloat b);
134 
136  GLboolean getDepthMask(void) const { return mDepthMask; }
137 
139  void setDepthMask(GLboolean mask);
140 
142  GLenum getDepthFunc(void) const { return mDepthFunc; }
143 
145  void setDepthFunc(GLenum func);
146 
148  GLclampf getClearDepth(void) const { return mClearDepth; }
149 
151  void setClearDepth(GLclampf depth);
152 
154  void setClearColour(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
155 
158 
160  void setColourMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
161 
163  GLuint getStencilMask(void) const { return mStencilMask; }
164 
166  void setStencilMask(GLuint mask);
167 
169  void setEnabled(GLenum flag);
170 
172  void setDisabled(GLenum flag);
173 
175  unsigned int getDiscardBuffers(void) const { return mDiscardBuffers; }
176 
178  void setDiscardBuffers(unsigned int flags) { mDiscardBuffers = flags; }
179 
181  GLenum getPolygonMode(void) const { return mPolygonMode; }
182 
184  void setPolygonMode(GLenum mode);
185 
187  GLenum getCullFace(void) const { return mCullFace; }
188 
190  void setCullFace(GLenum face);
191 
193  void enableTextureCoordGen(GLenum type);
195  void disableTextureCoordGen(GLenum type);
196 
197  // Set material lighting parameters
198  void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
199  void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
200  void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
201  void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
202  void setMaterialShininess(GLfloat shininess);
203  void setPointSize(GLfloat size);
204  void setPointParameters(GLfloat* attenuation, float minSize, float maxSize);
205 
207  void setViewport(GLint x, GLint y, GLsizei width, GLsizei height);
208 
210  void getViewport(int* array);
211  };
212 }
213 
214 #endif
void initializeCache()
See GLStateCacheManager.initializeCache.
GLclampf getClearDepth(void) const
See GLStateCacheManager.getClearDepth.
GLuint getStencilMask(void) const
See GLStateCacheManager.getStencilMask.
bool activateGLTextureUnit(size_t unit)
See GLStateCacheManager.activateGLTextureUnit.
void setShadeModel(GLenum model)
See GLStateCacheManager.setShadeModel.
GLclampf mClearDepth
Stores the current depth clearing colour.
GLenum getBlendEquation(void) const
See GLStateCacheManager.getBlendEquation.
vector< GLboolean >::type & getColourMask(void)
See GLStateCacheManager.getColourMask.
void setEnabled(GLenum flag)
See GLStateCacheManager.setEnabled.
void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
void setPointSize(GLfloat size)
void setClearColour(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
See GLStateCacheManager.setClearColour.
GLuint mStencilMask
Stores the current stencil mask.
unsigned int getDiscardBuffers(void) const
See GLStateCacheManager.getDiscardBuffers.
GLenum mPolygonMode
Stores the current polygon rendering mode.
void disableTextureCoordGen(GLenum type)
Disable the specified texture coordinate generation option for the currently active texture unit...
void setTexParameteri(GLenum target, GLenum pname, GLint param)
See GLStateCacheManager.setTexParameteri.
GLenum getCullFace(void) const
See GLStateCacheManager.getCullFace.
GLboolean mDepthMask
Stores the current depth write mask.
void enableTextureCoordGen(GLenum type)
Enable the specified texture coordinate generation option for the currently active texture unit...
unsigned int mDiscardBuffers
Mask of buffers who contents can be discarded if GL_EXT_discard_framebuffer is supported.
vector< GLboolean >::type mColourMask
Stores the current colour write mask.
void setBlendEquation(GLenum eq)
See GLStateCacheManager.setBlendEquation.
void setColourMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
See GLStateCacheManager.setColourMask.
size_t mActiveTextureUnit
Stores the currently active texture unit.
void setPointParameters(GLfloat *attenuation, float minSize, float maxSize)
void setMaterialShininess(GLfloat shininess)
void clearCache()
See GLStateCacheManager.clearCache.
GLenum getDepthFunc(void) const
See GLStateCacheManager.getDepthFunc.
int mViewport[4]
Viewport origin and size.
GLboolean getDepthMask(void) const
See GLStateCacheManager.getDepthMask.
void setDisabled(GLenum flag)
See GLStateCacheManager.setDisabled.
void deleteGLBuffer(GLenum target, GLuint buffer, bool force=false)
See GLStateCacheManager.deleteGLBuffer.
void setClearDepth(GLclampf depth)
See GLStateCacheManager.setClearDepth.
vector< GLclampf >::type mClearColour
Stores the current clear colour.
void invalidateStateForTexture(GLuint texture)
See GLStateCacheManager.invalidateStateForTexture.
void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
void bindGLTexture(GLenum target, GLuint texture)
See GLStateCacheManager.bindGLTexture.
GLenum mBlendFuncSource
Stores the current blend source function.
void setDiscardBuffers(unsigned int flags)
See GLStateCacheManager.setDiscardBuffers.
void setDepthMask(GLboolean mask)
See GLStateCacheManager.setDepthMask.
void setCullFace(GLenum face)
See GLStateCacheManager.setCullFace.
GLenum mCullFace
Stores the current face culling setting.
void setStencilMask(GLuint mask)
See GLStateCacheManager.setStencilMask.
This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info...
void getViewport(int *array)
Get viewport parameters.
GLenum mDepthFunc
Stores the current depth test function.
GLenum mBlendFuncDest
Stores the current blend destination function.
GLenum mBlendEquation
Stores the current blend equation.
GLenum getPolygonMode(void) const
See GLStateCacheManager.getPolygonMode.
void setPolygonMode(GLenum mode)
See GLStateCacheManager.setPolygonMode.
An in memory cache of the OpenGL state.
void setDepthFunc(GLenum func)
See GLStateCacheManager.setDepthFunc.
Ogre::GeneralAllocatedObject StateCacheAlloc
void setViewport(GLint x, GLint y, GLsizei width, GLsizei height)
Set viewport parameters.
void setLightAmbient(GLfloat r, GLfloat g, GLfloat b)
See GLStateCacheManager.setLightAmbient.
void bindGLBuffer(GLenum target, GLuint buffer, bool force=false)
See GLStateCacheManager.bindGLBuffer.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
void setBlendFunc(GLenum source, GLenum dest)
See GLStateCacheManager.setBlendFunc.

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Oct 22 2017 04:04:15