OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGLStateCacheManager.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 __GLStateCacheManager_H__
30 #define __GLStateCacheManager_H__
31 
32 #include "OgreGLPrerequisites.h"
33 #include "OgreStdHeaders.h"
34 #include "OgreIteratorWrappers.h"
35 
37 
38 namespace Ogre
39 {
40  class GLStateCacheManagerImp;
41 
56  {
57  private:
61 
63 
64  public:
65  GLStateCacheManager(void);
66  ~GLStateCacheManager(void);
67 
72  void unregisterContext (intptr_t id);
73 
77  void switchContext (intptr_t id);
78 
81  void clearCache();
82 
88  void bindGLBuffer(GLenum target, GLuint buffer, bool force = false);
89 
95  void deleteGLBuffer(GLenum target, GLuint buffer, bool force = false);
96 
101  void bindGLTexture(GLenum target, GLuint texture);
102 
106  void invalidateStateForTexture(GLuint texture);
107 
113  void setTexParameteri(GLenum target, GLenum pname, GLint param);
114 
119  bool activateGLTextureUnit(size_t unit);
120 
124  GLenum getBlendEquation(void) const;
125 
129  void setBlendEquation(GLenum eq);
130 
132  void setBlendEquation(GLenum eqRGB, GLenum eqA);
133 
138  void setBlendFunc(GLenum source, GLenum dest);
139 
140  void setShadeModel(GLenum model);
141 
142  void setLightAmbient(GLfloat r, GLfloat g, GLfloat b);
143 
147  GLboolean getDepthMask(void) const;
148 
152  void setDepthMask(GLboolean mask);
153 
157  GLenum getDepthFunc(void) const;
158 
162  void setDepthFunc(GLenum func);
163 
167  GLclampf getClearDepth(void) const;
168 
172  void setClearDepth(GLclampf depth);
173 
180  void setClearColour(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
181 
185  vector<GLboolean>::type & getColourMask(void) const;
186 
193  void setColourMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
194 
198  GLuint getStencilMask(void) const;
199 
203  void setStencilMask(GLuint mask);
204 
208  void setEnabled(GLenum flag, bool enabled);
209 
213  unsigned int getDiscardBuffers(void) const;
214 
218  void setDiscardBuffers(unsigned int flags);
219 
223  GLenum getPolygonMode(void) const;
224 
228  void setPolygonMode(GLenum mode);
229 
233  GLenum getCullFace(void) const;
234 
238  void setCullFace(GLenum face);
239 
241  void enableTextureCoordGen(GLenum type);
243  void disableTextureCoordGen(GLenum type);
244 
245  // Set material lighting parameters
246  void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
247  void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
248  void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
249  void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
250  void setMaterialShininess(GLfloat shininess);
251  void setPointSize(GLfloat size);
252  void setPointParameters(GLfloat* attenuation, float minSize, float maxSize);
253 
254  void setViewport(GLint x, GLint y, GLsizei width, GLsizei height);
255  void getViewport(int* array);
256  };
257 }
258 
259 #endif
Ogre::GeneralAllocatedObject StateCacheAlloc
MapIterator< CachesMap > CachesMapIterator
GLStateCacheManagerImp * mImp
#define _OgreGLExport
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
map< intptr_t, GLStateCacheManagerImp * >::type CachesMap
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
An in memory cache of the OpenGL state.
An in memory cache of the OpenGL state.