Changeset 3770 in orxonox.OLD for orxonox/branches/textEngine/src/lib/graphics/graphics_engine.cc
- Timestamp:
- Apr 10, 2005, 11:52:05 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/lib/graphics/graphics_engine.cc
r3681 r3770 167 167 168 168 169 /** 170 \brief entering 2D Mode 171 172 this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else 173 */ 174 void GraphicsEngine::enter2DMode(void) 175 { 176 SDL_Surface *screen = SDL_GetVideoSurface(); 177 178 /* Note, there may be other things you need to change, 179 depending on how you have your OpenGL state set up. 180 */ 181 glPushAttrib(GL_ENABLE_BIT); 182 glDisable(GL_DEPTH_TEST); 183 glDisable(GL_CULL_FACE); 184 glDisable(GL_LIGHTING); // will be set back when leaving 2D-mode 185 glEnable(GL_TEXTURE_2D); 186 187 /* This allows alpha blending of 2D textures with the scene */ 188 glEnable(GL_BLEND); 189 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 190 191 glViewport(0, 0, screen->w, screen->h); 192 193 glMatrixMode(GL_PROJECTION); 194 glPushMatrix(); 195 glLoadIdentity(); 196 197 glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0); 198 199 glMatrixMode(GL_MODELVIEW); 200 glPushMatrix(); 201 glLoadIdentity(); 202 203 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 204 } 205 206 /** 207 \brief leaves the 2DMode again also \see Font::enter2DMode(void) 208 */ 209 void GraphicsEngine::leave2DMode(void) 210 { 211 glMatrixMode(GL_MODELVIEW); 212 glPopMatrix(); 213 214 glMatrixMode(GL_PROJECTION); 215 glPopMatrix(); 216 217 glPopAttrib(); 218 } 169 219 170 220
Note: See TracChangeset
for help on using the changeset viewer.