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-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 __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);
209 
213  void setDisabled(GLenum flag);
214 
218  unsigned int getDiscardBuffers(void) const;
219 
223  void setDiscardBuffers(unsigned int flags);
224 
228  GLenum getPolygonMode(void) const;
229 
233  void setPolygonMode(GLenum mode);
234 
238  GLenum getCullFace(void) const;
239 
243  void setCullFace(GLenum face);
244 
246  void enableTextureCoordGen(GLenum type);
248  void disableTextureCoordGen(GLenum type);
249 
250  // Set material lighting parameters
251  void setMaterialAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
252  void setMaterialDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
253  void setMaterialEmissive(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
254  void setMaterialSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
255  void setMaterialShininess(GLfloat shininess);
256  void setPointSize(GLfloat size);
257  void setPointParameters(GLfloat* attenuation, float minSize, float maxSize);
258 
259  void setViewport(GLint x, GLint y, GLsizei width, GLsizei height);
260  void getViewport(int* array);
261  };
262 }
263 
264 #endif
GLStateCacheManagerImp * mImp
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
An in memory cache of the OpenGL state.
MapIterator< CachesMap > CachesMapIterator
Ogre::GeneralAllocatedObject StateCacheAlloc
#define _OgreGLExport
map< intptr_t, GLStateCacheManagerImp * >::type CachesMap
An in memory cache of the OpenGL state.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...

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 Mar 18 2014 19:15:25