Changeset 3770 in orxonox.OLD for orxonox/branches/textEngine
- Timestamp:
- Apr 10, 2005, 11:52:05 PM (20 years ago)
- Location:
- orxonox/branches/textEngine/src
- Files:
-
- 5 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 -
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 -
orxonox/branches/textEngine/src/lib/graphics/graphics_engine.h
r3716 r3770 37 37 static bool texturesEnabled; 38 38 39 static void enter2DMode(void); 40 static void leave2DMode(void); 41 39 42 private: 40 43 GraphicsEngine(); -
orxonox/branches/textEngine/src/story_entities/world.cc
r3769 r3770 350 350 this->glmis->step(); 351 351 this->testText = TextEngine::getInstance()->createText("fonts/earth.ttf"); 352 testText->setText("test"); 353 testText->setBindNode(tn); 352 354 353 355 break;
Note: See TracChangeset
for help on using the changeset viewer.