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
Ogre::GLStateCacheManagerImp::setColourMask
void setColourMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
See GLStateCacheManager.setColourMask.
Ogre::GLStateCacheManagerImp::setMaterialShininess
void setMaterialShininess(GLfloat shininess)
StateCacheAlloc
Ogre::GeneralAllocatedObject StateCacheAlloc
Definition: OgreGLNullStateCacheManagerImp.h:34
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::GLStateCacheManagerImp::setViewport
void setViewport(GLint x, GLint y, GLsizei width, GLsizei height)
Set viewport parameters.
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::GLStateCacheManagerImp::invalidateStateForTexture
void invalidateStateForTexture(GLuint texture)
See GLStateCacheManager.invalidateStateForTexture.
Ogre::GLStateCacheManagerImp::mViewport
int mViewport[4]
Viewport origin and size.
Definition: OgreGLNullStateCacheManagerImp.h:71
Ogre::GLStateCacheManagerImp::mClearDepth
GLclampf mClearDepth
Stores the current depth clearing colour.
Definition: OgreGLNullStateCacheManagerImp.h:69
Ogre::GLStateCacheManagerImp::getBlendEquation
GLenum getBlendEquation(void) const
See GLStateCacheManager.getBlendEquation.
Definition: OgreGLNullStateCacheManagerImp.h:118
Ogre::GLStateCacheManagerImp::setClearDepth
void setClearDepth(GLclampf depth)
See GLStateCacheManager.setClearDepth.
Ogre::GLStateCacheManagerImp::mEmissive
GLfloat mEmissive[4]
Definition: OgreGLNullStateCacheManagerImp.h:80
Ogre::GLStateCacheManagerImp::GLStateCacheManagerImp
GLStateCacheManagerImp(void)
Ogre::GLStateCacheManagerImp::initializeCache
void initializeCache()
See GLStateCacheManager.initializeCache.
Ogre::GLStateCacheManagerImp::getClearDepth
GLclampf getClearDepth(void) const
See GLStateCacheManager.getClearDepth.
Definition: OgreGLNullStateCacheManagerImp.h:148
Ogre::GLStateCacheManagerImp::mBlendFuncSource
GLenum mBlendFuncSource
Stores the current blend source function.
Definition: OgreGLNullStateCacheManagerImp.h:55
Ogre::GLStateCacheManagerImp::deleteGLBuffer
void deleteGLBuffer(GLenum target, GLuint buffer, bool force=false)
See GLStateCacheManager.deleteGLBuffer.
Ogre::GLStateCacheManagerImp::setCullFace
void setCullFace(GLenum face)
See GLStateCacheManager.setCullFace.
Ogre::GLStateCacheManagerImp::mShininess
GLfloat mShininess
Definition: OgreGLNullStateCacheManagerImp.h:82
Ogre::GLStateCacheManagerImp::activateGLTextureUnit
bool activateGLTextureUnit(size_t unit)
See GLStateCacheManager.activateGLTextureUnit.
Ogre::GLStateCacheManagerImp::mShadeModel
GLenum mShadeModel
Definition: OgreGLNullStateCacheManagerImp.h:75
Ogre::GLStateCacheManagerImp::mAmbient
GLfloat mAmbient[4]
Definition: OgreGLNullStateCacheManagerImp.h:77
Ogre::GLStateCacheManagerImp::getViewport
void getViewport(int *array)
Get viewport parameters.
Ogre::GLStateCacheManagerImp::setDepthMask
void setDepthMask(GLboolean mask)
See GLStateCacheManager.setDepthMask.
Ogre::GLStateCacheManagerImp::getPolygonMode
GLenum getPolygonMode(void) const
See GLStateCacheManager.getPolygonMode.
Definition: OgreGLNullStateCacheManagerImp.h:181
Ogre::GLStateCacheManagerImp::setShadeModel
void setShadeModel(GLenum model)
See GLStateCacheManager.setShadeModel.
Ogre::GLStateCacheManagerImp::mCullFace
GLenum mCullFace
Stores the current face culling setting.
Definition: OgreGLNullStateCacheManagerImp.h:59
Ogre::GLStateCacheManagerImp::setPolygonMode
void setPolygonMode(GLenum mode)
See GLStateCacheManager.setPolygonMode.
Ogre::GLStateCacheManagerImp::mBlendFuncDest
GLenum mBlendFuncDest
Stores the current blend destination function.
Definition: OgreGLNullStateCacheManagerImp.h:57
Ogre::GLStateCacheManagerImp::mBlendEquation
GLenum mBlendEquation
Stores the current blend equation.
Definition: OgreGLNullStateCacheManagerImp.h:53
Ogre::GLStateCacheManagerImp::bindGLBuffer
void bindGLBuffer(GLenum target, GLuint buffer, bool force=false)
See GLStateCacheManager.bindGLBuffer.
Ogre::GLStateCacheManagerImp::~GLStateCacheManagerImp
~GLStateCacheManagerImp(void)
Ogre::GLStateCacheManagerImp::setDepthFunc
void setDepthFunc(GLenum func)
See GLStateCacheManager.setDepthFunc.
Ogre::GLStateCacheManagerImp::clearCache
void clearCache()
See GLStateCacheManager.clearCache.
Ogre::GLStateCacheManagerImp::getDepthFunc
GLenum getDepthFunc(void) const
See GLStateCacheManager.getDepthFunc.
Definition: OgreGLNullStateCacheManagerImp.h:142
Ogre::GLStateCacheManagerImp::mStencilMask
GLuint mStencilMask
Stores the current stencil mask.
Definition: OgreGLNullStateCacheManagerImp.h:63
Ogre::GLStateCacheManagerImp::mBlendEquationAlpha
GLenum mBlendEquationAlpha
Definition: OgreGLNullStateCacheManagerImp.h:74
Ogre::GLStateCacheManagerImp::setPointParameters
void setPointParameters(GLfloat *attenuation, float minSize, float maxSize)
Ogre::GLStateCacheManagerImp::mDepthMask
GLboolean mDepthMask
Stores the current depth write mask.
Definition: OgreGLNullStateCacheManagerImp.h:49
Ogre::GLStateCacheManagerImp::mPointSize
GLfloat mPointSize
Definition: OgreGLNullStateCacheManagerImp.h:84
Ogre::GLStateCacheManagerImp::disableTextureCoordGen
void disableTextureCoordGen(GLenum type)
Disable the specified texture coordinate generation option for the currently active texture unit.
Ogre::GLStateCacheManagerImp
An in memory cache of the OpenGL state.
Definition: OgreGLNullStateCacheManagerImp.h:41
Ogre::GLStateCacheManagerImp::mDiffuse
GLfloat mDiffuse[4]
Definition: OgreGLNullStateCacheManagerImp.h:78
Ogre::GLStateCacheManagerImp::setTexParameteri
void setTexParameteri(GLenum target, GLenum pname, GLint param)
See GLStateCacheManager.setTexParameteri.
Ogre::GLStateCacheManagerImp::getCullFace
GLenum getCullFace(void) const
See GLStateCacheManager.getCullFace.
Definition: OgreGLNullStateCacheManagerImp.h:187
OgreGLPrerequisites.h
Ogre::GLStateCacheManagerImp::enableTextureCoordGen
void enableTextureCoordGen(GLenum type)
Enable the specified texture coordinate generation option for the currently active texture unit.
Ogre::GLStateCacheManagerImp::setLightAmbient
void setLightAmbient(GLfloat r, GLfloat g, GLfloat b)
See GLStateCacheManager.setLightAmbient.
Ogre::GLStateCacheManagerImp::getDepthMask
GLboolean getDepthMask(void) const
See GLStateCacheManager.getDepthMask.
Definition: OgreGLNullStateCacheManagerImp.h:136
Ogre::GLStateCacheManagerImp::setMaterialEmissive
void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
Ogre::GLStateCacheManagerImp::setBlendEquation
void setBlendEquation(GLenum eq)
See GLStateCacheManager.setBlendEquation.
Ogre::GLStateCacheManagerImp::setBlendFunc
void setBlendFunc(GLenum source, GLenum dest)
See GLStateCacheManager.setBlendFunc.
Ogre::GLStateCacheManagerImp::mClearColour
vector< GLclampf >::type mClearColour
Stores the current clear colour.
Definition: OgreGLNullStateCacheManagerImp.h:45
Ogre::GLStateCacheManagerImp::mDiscardBuffers
unsigned int mDiscardBuffers
Mask of buffers who contents can be discarded if GL_EXT_discard_framebuffer is supported.
Definition: OgreGLNullStateCacheManagerImp.h:67
Ogre::GLStateCacheManagerImp::setDiscardBuffers
void setDiscardBuffers(unsigned int flags)
See GLStateCacheManager.setDiscardBuffers.
Definition: OgreGLNullStateCacheManagerImp.h:178
Ogre::GLStateCacheManagerImp::mColourMask
vector< GLboolean >::type mColourMask
Stores the current colour write mask.
Definition: OgreGLNullStateCacheManagerImp.h:47
Ogre::GLStateCacheManagerImp::getStencilMask
GLuint getStencilMask(void) const
See GLStateCacheManager.getStencilMask.
Definition: OgreGLNullStateCacheManagerImp.h:163
Ogre::GLStateCacheManagerImp::bindGLTexture
void bindGLTexture(GLenum target, GLuint texture)
See GLStateCacheManager.bindGLTexture.
Ogre::GLStateCacheManagerImp::setStencilMask
void setStencilMask(GLuint mask)
See GLStateCacheManager.setStencilMask.
Ogre::GLStateCacheManagerImp::mPointAttenuation
GLfloat mPointAttenuation[3]
Definition: OgreGLNullStateCacheManagerImp.h:87
Ogre::GLStateCacheManagerImp::mLightAmbient
GLfloat mLightAmbient[4]
Definition: OgreGLNullStateCacheManagerImp.h:81
Ogre::GLStateCacheManagerImp::setDisabled
void setDisabled(GLenum flag)
See GLStateCacheManager.setDisabled.
Ogre::GLStateCacheManagerImp::setPointSize
void setPointSize(GLfloat size)
Ogre::GLStateCacheManagerImp::getColourMask
vector< GLboolean >::type & getColourMask(void)
See GLStateCacheManager.getColourMask.
Definition: OgreGLNullStateCacheManagerImp.h:157
Ogre::GLStateCacheManagerImp::setMaterialSpecular
void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
Ogre::GLStateCacheManagerImp::getDiscardBuffers
unsigned int getDiscardBuffers(void) const
See GLStateCacheManager.getDiscardBuffers.
Definition: OgreGLNullStateCacheManagerImp.h:175
Ogre::GLStateCacheManagerImp::setEnabled
void setEnabled(GLenum flag)
See GLStateCacheManager.setEnabled.
Ogre::GLStateCacheManagerImp::mPointSizeMax
GLfloat mPointSizeMax
Definition: OgreGLNullStateCacheManagerImp.h:86
Ogre::GLStateCacheManagerImp::setMaterialDiffuse
void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
Ogre::GLStateCacheManagerImp::mPointSizeMin
GLfloat mPointSizeMin
Definition: OgreGLNullStateCacheManagerImp.h:85
Ogre::GLStateCacheManagerImp::setMaterialAmbient
void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
Ogre::GLStateCacheManagerImp::setClearColour
void setClearColour(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
See GLStateCacheManager.setClearColour.
Ogre::GLStateCacheManagerImp::mDepthFunc
GLenum mDepthFunc
Stores the current depth test function.
Definition: OgreGLNullStateCacheManagerImp.h:61
Ogre::GLStateCacheManagerImp::mPolygonMode
GLenum mPolygonMode
Stores the current polygon rendering mode.
Definition: OgreGLNullStateCacheManagerImp.h:51
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::GLStateCacheManagerImp::mBlendEquationRGB
GLenum mBlendEquationRGB
Definition: OgreGLNullStateCacheManagerImp.h:73
Ogre::GLStateCacheManagerImp::mActiveTextureUnit
size_t mActiveTextureUnit
Stores the currently active texture unit.
Definition: OgreGLNullStateCacheManagerImp.h:65
Ogre::GLStateCacheManagerImp::mSpecular
GLfloat mSpecular[4]
Definition: OgreGLNullStateCacheManagerImp.h:79

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 Tue Apr 13 2021 08:53:15