Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3844 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Apr 17, 2005, 12:41:57 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: GraphicsEngine now stores the glMatrices, when transforming into 2D-mode

Location:
orxonox/trunk/src/lib/graphics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r3790 r3844  
    174174void GraphicsEngine::enter2DMode(void)
    175175{
     176  GraphicsEngine::storeMatrices();
    176177  SDL_Surface *screen = SDL_GetVideoSurface();
    177178 
     
    218219}
    219220
     221/**
     222   \brief stores the GL_matrices
     223*/
     224void GraphicsEngine::storeMatrices(void)
     225{
     226  glGetDoublev(GL_PROJECTION_MATRIX, GraphicsEngine::projMat);
     227  glGetDoublev(GL_MODELVIEW_MATRIX, GraphicsEngine::modMat);
     228  glGetIntegerv(GL_VIEWPORT, GraphicsEngine::viewPort);
     229}
     230
     231//! the stored ModelView Matrix.
     232GLdouble GraphicsEngine::modMat[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
     233//! the stored Projection Matrix
     234GLdouble GraphicsEngine::projMat[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
     235//! The ViewPort
     236GLint GraphicsEngine::viewPort[4] = {0,0,0,0};
    220237
    221238
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r3790 r3844  
    4040  static void leave2DMode(void);
    4141
     42  static void storeMatrices(void);
     43  static GLdouble modMat[16];
     44  static GLdouble projMat[16];
     45  static GLint viewPort[4];
     46
     47
     48
    4249 private:
    4350  GraphicsEngine();
  • orxonox/trunk/src/lib/graphics/text_engine.cc

    r3843 r3844  
    183183void Text::draw(void) const
    184184{
    185   // storing all the Transformation Matrices.
    186   GLdouble modMat[16];
    187   GLdouble projMat[16];
    188   GLint viewPort[4];
    189   glGetDoublev(GL_PROJECTION_MATRIX, projMat);
    190   glGetDoublev(GL_MODELVIEW_MATRIX, modMat);
    191   glGetIntegerv(GL_VIEWPORT, viewPort);
    192 
    193   GraphicsEngine::enter2DMode();
    194 
    195 
    196185  // setting the Position of this Text.
    197186  Vector pos;
     
    202191      GLdouble z = this->bindNode->getAbsCoor().z;
    203192      GLdouble tmp[3];
    204       gluProject(x, y, z, modMat, projMat, viewPort, tmp, tmp+1, tmp+2);
     193      gluProject(x, y, z, GraphicsEngine::modMat, GraphicsEngine::projMat, GraphicsEngine::viewPort, tmp, tmp+1, tmp+2);
    205194      pos.x = tmp[0] + this->posSize.x;
    206195      pos.y = GraphicsEngine::getInstance()->getResolutionY() - tmp[1] + this->posSize.y;
     
    266255    }
    267256  glPopMatrix();
    268   GraphicsEngine::leave2DMode();
    269257}
    270258
     
    931919void TextEngine::draw(void) const
    932920{
     921  // entering 3D-mode
     922  GraphicsEngine::enter2DMode();
     923  // drawing all the texts
    933924  tIterator<Text>* textIterator = textList->getIterator();
    934925  Text* text = textIterator->nextElement();
     
    939930    }
    940931  delete textIterator;
     932  // retruning to the previous mode
     933  GraphicsEngine::leave2DMode();
    941934}
    942935
Note: See TracChangeset for help on using the changeset viewer.