Changeset 5317 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Oct 8, 2005, 11:43:09 AM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/render_2d.cc
r5286 r5317 22 22 #include "list.h" 23 23 #include "element_2d.h" 24 25 #include "shader.h" 24 26 25 27 #include <math.h> … … 124 126 void Render2D::draw(unsigned int layer) const 125 127 { 128 Shader::suspendShader(); 129 126 130 GraphicsEngine::enter2DMode(); 127 131 … … 146 150 GraphicsEngine::leave2DMode(); 147 151 152 Shader::restoreShader(); 148 153 } -
trunk/src/lib/graphics/shader.cc
r5285 r5317 81 81 } 82 82 83 Shader* Shader::storedShader = NULL; 84 83 85 84 86 bool Shader::loadShaderProgramm(SHADER_TYPE type, const char* fileName) … … 154 156 { 155 157 if (likely (this->shaderProgram != 0)) 158 { 156 159 glUseProgramObjectARB(this->shaderProgram); 160 Shader::storedShader = this; 161 } 157 162 } 158 163 … … 160 165 { 161 166 glUseProgramObjectARB(0); 167 Shader::storedShader = NULL; 162 168 } 163 169 -
trunk/src/lib/graphics/shader.h
r5266 r5317 36 36 char* fileRead(const char* fileName); 37 37 38 static bool checkShaderAbility(); 39 40 inline static bool shaderActive() { return (Shader::storedShader != NULL)?true:false; }; 41 inline static void suspendShader() { Shader* currShader=storedShader; if (currShader!= NULL) { Shader::deactivateShader(); Shader::storedShader = currShader;} }; 42 inline static void restoreShader() { if (storedShader != NULL) storedShader->activateShader(); storedShader = NULL; }; 43 44 38 45 void printError(GLenum program); 39 46 void debug() const; … … 47 54 GLenum vertexShader; 48 55 GLenum fragmentShader; 56 57 static Shader* storedShader; 49 58 }; 50 59
Note: See TracChangeset
for help on using the changeset viewer.