Changeset 3770 in orxonox.OLD for orxonox/branches/textEngine/src/lib/graphics/font
- Timestamp:
- Apr 10, 2005, 11:52:05 PM (20 years ago)
- Location:
- orxonox/branches/textEngine/src/lib/graphics/font
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/lib/graphics/font/text_engine.cc
r3769 r3770 45 45 // initialize this Text 46 46 this->bindNode = NULL; 47 this->font = font; 47 48 this->text = NULL; 48 49 this->texture = 0; 49 this->setType( TEXT_DYNAMIC);50 this->setType(type); 50 51 this->setPosition(0, 0); 51 52 … … 146 147 glGetIntegerv(GL_VIEWPORT, viewPort); 147 148 148 printf("rendering some Text\n"); 149 //enter2DMode(); 149 GraphicsEngine::enter2DMode(); 150 150 151 151 … … 192 192 glEnd(); 193 193 } 194 else //(if type &TEXT_DYNAMIC)194 else //(if type == TEXT_DYNAMIC) 195 195 { 196 196 Glyph** glyphArray = this->font->getGlyphArray(); … … 199 199 glTranslatef(pos.x, pos.y, 0); 200 200 201 printf("%d, %d\n", this->font->getFastTextureID(), glyphArray[65]->displayList);201 // printf("%d, %d\n", this->font->getFastTextureID(), glyphArray[65]->displayList); 202 202 char* tmpText = this->text; 203 203 while (*tmpText != '\0') … … 211 211 } 212 212 } 213 //leave2DMode();213 GraphicsEngine::leave2DMode(); 214 214 } 215 215 … … 400 400 return rg; 401 401 } 402 403 /**404 \brief entering 2D Mode405 406 this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else407 */408 void Font::enter2DMode(void)409 {410 SDL_Surface *screen = SDL_GetVideoSurface();411 412 /* Note, there may be other things you need to change,413 depending on how you have your OpenGL state set up.414 */415 glPushAttrib(GL_ENABLE_BIT);416 glDisable(GL_DEPTH_TEST);417 glDisable(GL_CULL_FACE);418 glDisable(GL_LIGHTING); // will be set back when leaving 2D-mode419 glEnable(GL_TEXTURE_2D);420 421 /* This allows alpha blending of 2D textures with the scene */422 glEnable(GL_BLEND);423 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);424 425 glViewport(0, 0, screen->w, screen->h);426 427 glMatrixMode(GL_PROJECTION);428 glPushMatrix();429 glLoadIdentity();430 431 glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);432 433 glMatrixMode(GL_MODELVIEW);434 glPushMatrix();435 glLoadIdentity();436 437 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);438 }439 440 /**441 \brief leaves the 2DMode again also \see Font::enter2DMode(void)442 */443 void Font::leave2DMode(void)444 {445 glMatrixMode(GL_MODELVIEW);446 glPopMatrix();447 448 glMatrixMode(GL_PROJECTION);449 glPopMatrix();450 451 glPopAttrib();452 }453 454 402 455 403 GLuint Font::createFastTexture(void) … … 874 822 875 823 newText = new Text(tmpFont, TEXT_DYNAMIC); 824 textList->add(newText); 825 826 return newText; 876 827 } 877 828 -
orxonox/branches/textEngine/src/lib/graphics/font/text_engine.h
r3769 r3770 170 170 Glyph* getGlyphMetrics(Uint16 character); 171 171 172 void enter2DMode(void);173 void leave2DMode(void);174 175 176 172 GLuint createFastTexture(); 177 173
Note: See TracChangeset
for help on using the changeset viewer.