OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2014 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, bool enabled);
170 
172  unsigned int getDiscardBuffers(void) const { return mDiscardBuffers; }
173 
175  void setDiscardBuffers(unsigned int flags) { mDiscardBuffers = flags; }
176 
178  GLenum getPolygonMode(void) const { return mPolygonMode; }
179 
181  void setPolygonMode(GLenum mode);
182 
184  GLenum getCullFace(void) const { return mCullFace; }
185 
187  void setCullFace(GLenum face);
188 
190  void enableTextureCoordGen(GLenum type);
192  void disableTextureCoordGen(GLenum type);
193 
194  // Set material lighting parameters
195  void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
196  void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
197  void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
198  void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
199  void setMaterialShininess(GLfloat shininess);
200  void setPointSize(GLfloat size);
201  void setPointParameters(GLfloat* attenuation, float minSize, float maxSize);
202 
204  void setViewport(GLint x, GLint y, GLsizei width, GLsizei height);
205 
207  void getViewport(int* array);
208  };
209 }
210 
211 #endif
GLenum getCullFace(void) const
See GLStateCacheManager.getCullFace.
GLenum mBlendEquation
Stores the current blend equation.
GLenum getBlendEquation(void) const
See GLStateCacheManager.getBlendEquation.
void setClearColour(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
See GLStateCacheManager.setClearColour.
void deleteGLBuffer(GLenum target, GLuint buffer, bool force=false)
See GLStateCacheManager.deleteGLBuffer.
void invalidateStateForTexture(GLuint texture)
See GLStateCacheManager.invalidateStateForTexture.
size_t mActiveTextureUnit
Stores the currently active texture unit.
void setPointParameters(GLfloat *attenuation, float minSize, float maxSize)
GLuint mStencilMask
Stores the current stencil mask.
unsigned int getDiscardBuffers(void) const
See GLStateCacheManager.getDiscardBuffers.
void setStencilMask(GLuint mask)
See GLStateCacheManager.setStencilMask.
GLuint getStencilMask(void) const
See GLStateCacheManager.getStencilMask.
void bindGLBuffer(GLenum target, GLuint buffer, bool force=false)
See GLStateCacheManager.bindGLBuffer.
GLboolean getDepthMask(void) const
See GLStateCacheManager.getDepthMask.
void setCullFace(GLenum face)
See GLStateCacheManager.setCullFace.
void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
void setColourMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
See GLStateCacheManager.setColourMask.
void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
void setShadeModel(GLenum model)
See GLStateCacheManager.setShadeModel.
GLenum mDepthFunc
Stores the current depth test function.
GLenum mBlendFuncDest
Stores the current blend destination function.
GLclampf getClearDepth(void) const
See GLStateCacheManager.getClearDepth.
void enableTextureCoordGen(GLenum type)
Enable the specified texture coordinate generation option for the currently active texture unit...
void setTexParameteri(GLenum target, GLenum pname, GLint param)
See GLStateCacheManager.setTexParameteri.
void disableTextureCoordGen(GLenum type)
Disable the specified texture coordinate generation option for the currently active texture unit...
vector< GLboolean >::type mColourMask
Stores the current colour write mask.
void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
void clearCache()
See GLStateCacheManager.clearCache.
GLboolean mDepthMask
Stores the current depth write mask.
void setPointSize(GLfloat size)
void bindGLTexture(GLenum target, GLuint texture)
See GLStateCacheManager.bindGLTexture.
Ogre::GeneralAllocatedObject StateCacheAlloc
void setBlendEquation(GLenum eq)
See GLStateCacheManager.setBlendEquation.
GLclampf mClearDepth
Stores the current depth clearing colour.
vector< GLclampf >::type mClearColour
Stores the current clear colour.
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.
GLenum mPolygonMode
Stores the current polygon rendering mode.
GLenum mCullFace
Stores the current face culling setting.
int mViewport[4]
Viewport origin and size.
GLenum getDepthFunc(void) const
See GLStateCacheManager.getDepthFunc.
An in memory cache of the OpenGL state.
void setViewport(GLint x, GLint y, GLsizei width, GLsizei height)
Set viewport parameters.
vector< GLboolean >::type & getColourMask(void)
See GLStateCacheManager.getColourMask.
void setLightAmbient(GLfloat r, GLfloat g, GLfloat b)
See GLStateCacheManager.setLightAmbient.
void setDepthFunc(GLenum func)
See GLStateCacheManager.setDepthFunc.
void initializeCache()
See GLStateCacheManager.initializeCache.
void getViewport(int *array)
Get viewport parameters.
void setClearDepth(GLclampf depth)
See GLStateCacheManager.setClearDepth.
void setDepthMask(GLboolean mask)
See GLStateCacheManager.setDepthMask.
void setPolygonMode(GLenum mode)
See GLStateCacheManager.setPolygonMode.
void setMaterialShininess(GLfloat shininess)
bool activateGLTextureUnit(size_t unit)
See GLStateCacheManager.activateGLTextureUnit.
void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
unsigned int mDiscardBuffers
Mask of buffers who contents can be discarded if GL_EXT_discard_framebuffer is supported.
void setEnabled(GLenum flag, bool enabled)
See GLStateCacheManager.setEnabled.
GLenum mBlendFuncSource
Stores the current blend source function.
void setDiscardBuffers(unsigned int flags)
See GLStateCacheManager.setDiscardBuffers.
GLenum getPolygonMode(void) const
See GLStateCacheManager.getPolygonMode.