Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2005, 11:52:05 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: textEngine rendering again

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  
    4545  // initialize this Text
    4646  this->bindNode = NULL;
     47  this->font = font;
    4748  this->text = NULL;
    4849  this->texture = 0;
    49   this->setType(TEXT_DYNAMIC);
     50  this->setType(type);
    5051  this->setPosition(0, 0);
    5152
     
    146147  glGetIntegerv(GL_VIEWPORT, viewPort);
    147148
    148   printf("rendering some Text\n");
    149   //enter2DMode();
     149  GraphicsEngine::enter2DMode();
    150150
    151151
     
    192192      glEnd();
    193193    }
    194   else //(if type & TEXT_DYNAMIC)
     194  else //(if type == TEXT_DYNAMIC)
    195195    {
    196196      Glyph** glyphArray = this->font->getGlyphArray();
     
    199199      glTranslatef(pos.x, pos.y, 0);
    200200
    201       printf("%d, %d\n", this->font->getFastTextureID(), glyphArray[65]->displayList);
     201      //      printf("%d, %d\n", this->font->getFastTextureID(), glyphArray[65]->displayList);
    202202      char* tmpText = this->text;
    203203      while (*tmpText != '\0')
     
    211211        }
    212212    }
    213   //leave2DMode();
     213  GraphicsEngine::leave2DMode();
    214214}
    215215
     
    400400  return rg;
    401401}
    402 
    403 /**
    404    \brief entering 2D Mode
    405    
    406    this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else
    407 */
    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-mode
    419   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 
    454402
    455403GLuint Font::createFastTexture(void)
     
    874822
    875823  newText = new Text(tmpFont, TEXT_DYNAMIC);
     824  textList->add(newText);
     825
     826  return newText;
    876827}
    877828
  • orxonox/branches/textEngine/src/lib/graphics/font/text_engine.h

    r3769 r3770  
    170170  Glyph* getGlyphMetrics(Uint16 character);
    171171
    172   void enter2DMode(void);
    173   void leave2DMode(void);
    174 
    175 
    176172  GLuint createFastTexture();
    177173
Note: See TracChangeset for help on using the changeset viewer.