Index: orxonox/trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/graphics_engine.cc	(revision 4584)
+++ orxonox/trunk/src/lib/graphics/graphics_engine.cc	(revision 4597)
@@ -1,3 +1,3 @@
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -29,10 +29,11 @@
    \todo this constructor is not jet implemented - do it
 */
-GraphicsEngine::GraphicsEngine () 
-{
+GraphicsEngine::GraphicsEngine ()
+{
+  this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");
+  this->setName("GraphicsEngine");
   this->bDisplayFPS = false;
   this->minFPS = 9999;
   this->maxFPS = 0;
-  this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");
 
   this->fullscreen = false;
@@ -51,5 +52,5 @@
    \brief destructs the graphicsEngine.
 */
-GraphicsEngine::~GraphicsEngine () 
+GraphicsEngine::~GraphicsEngine ()
 {
   // delete what has to be deleted here
@@ -79,10 +80,10 @@
   if( videoInfo == NULL)
     {
-      PRINTF(1)("Failed getting Video Info :%s\n", SDL_GetError()); 
+      PRINTF(1)("Failed getting Video Info :%s\n", SDL_GetError());
       SDL_Quit ();
     }
   if( videoInfo->hw_available)
     this->videoFlags |= SDL_HWSURFACE;
-  else 
+  else
     this->videoFlags |= SDL_SWSURFACE;
   /*
@@ -93,12 +94,12 @@
   // setting up the Resolution
   this->setResolution(800, 600, 16);
-  
+
   // Set window labeling
   SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
-  
+
   // TO DO: Create a cool icon and use it here
   char* loadPic = new char[strlen(ResourceManager::getInstance()->getDataDir())+ 100];
   sprintf(loadPic, "%s%s", ResourceManager::getInstance()->getDataDir(),  "pictures/orxonox-icon32x32.bmp");
-  SDL_WM_SetIcon(SDL_LoadBMP(loadPic), NULL);  
+  SDL_WM_SetIcon(SDL_LoadBMP(loadPic), NULL);
   delete loadPic;
   // Enable default GL stuff
@@ -117,9 +118,9 @@
   //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
   //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
-  
-
-  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
-  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);    
-  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);  
+
+
+  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);
+  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);
   SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
   SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
@@ -144,5 +145,5 @@
   else
     fullscreenFlag = 0;
-  
+
   printf ("ok\n");
   if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags | fullscreenFlag)) == NULL)
@@ -195,5 +196,5 @@
 /**
    \brief entering 2D Mode
-   
+
    this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else
 */
@@ -202,5 +203,5 @@
   GraphicsEngine::storeMatrices();
   SDL_Surface *screen = SDL_GetVideoSurface();
-  
+
   /* Note, there may be other things you need to change,
      depending on how you have your OpenGL state set up.
@@ -215,17 +216,17 @@
   glEnable(GL_BLEND);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-  
+
   glViewport(0, 0, screen->w, screen->h);
-  
+
   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
   glLoadIdentity();
-  
+
   glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);
-  
+
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
   glLoadIdentity();
-  
+
   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 }
@@ -238,13 +239,13 @@
   glMatrixMode(GL_MODELVIEW);
   glPopMatrix();
-  
+
   glMatrixMode(GL_PROJECTION);
   glPopMatrix();
-  
+
   glPopAttrib();
 }
 
 /**
-   \brief stores the GL_matrices 
+   \brief stores the GL_matrices
 */
 void GraphicsEngine::storeMatrices(void)
@@ -271,5 +272,5 @@
   /* Get available fullscreen/hardware modes */
   this->videoModes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
-  
+
   /* Check is there are any modes available */
   if(this->videoModes == (SDL_Rect **)0){
@@ -277,5 +278,5 @@
     exit(-1);
   }
-  
+
   /* Check if our resolution is restricted */
   if(this->videoModes == (SDL_Rect **)-1){
@@ -301,5 +302,5 @@
       if( unlikely(this->currentFPS > this->maxFPS)) this->maxFPS = this->currentFPS;
       if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
-      
+
 #ifndef NO_TEXT
       char tmpChar1[20];
@@ -315,5 +316,5 @@
     }
 }
-  
+
 /**
    \brief displays the Frames per second
@@ -335,5 +336,5 @@
       this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
       this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
-      this->geTextMinFPS->setPosition(5, 560);	
+      this->geTextMinFPS->setPosition(5, 560);
 #endif /* NO_TEXT */
     }
@@ -341,3 +342,3 @@
 }
 
-  
+
Index: orxonox/trunk/src/lib/graphics/light.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/light.cc	(revision 4584)
+++ orxonox/trunk/src/lib/graphics/light.cc	(revision 4597)
@@ -1,5 +1,5 @@
 
 
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -36,6 +36,6 @@
 {
   this->setClassID(CL_LIGHT, "Light");
-  char tmpName[7];
-  sprintf(tmpName, "Light%d", lightNumber);
+  char tmpName[10];
+  sprintf(tmpName, "Light[%d]", lightNumber);
   this->setName(tmpName);
 
@@ -43,5 +43,5 @@
   // enable The light
   glEnable(lightsV[lightNumber]); // postSpawn
-  
+
   // set values (defaults)
   this->lightNumber = lightNumber;
@@ -179,5 +179,5 @@
 /**
    \brief draws this Light. Being a World-entity the possibility to do this lies at hand.
-*/ 
+*/
 void Light::draw()
 {
@@ -195,5 +195,5 @@
   PRINT(0)(":: %d ::  -- reference %p\n", this->lightNumber, this);
   PRINT(0)(" GL-state: ");
-  GLboolean param; 
+  GLboolean param;
   glGetBooleanv(lightsV[this->lightNumber], &param);
   if (param)
@@ -201,5 +201,5 @@
   else
     PRINT(0)("OFF\n");
-  
+
   PRINT(0)(" Position:      %f/%f/%f\n", this->lightPosition[0], this->lightPosition[1], this->lightPosition[2]);
   PRINT(0)(" DiffuseColor:  %f/%f/%f\n", this->diffuseColor[0], this->diffuseColor[1], this->diffuseColor[2]);
@@ -215,5 +215,5 @@
    \brief standard constructor for a Light
 */
-LightManager::LightManager () 
+LightManager::LightManager ()
 {
   this->setClassID(CL_LIGHT_MANAGER, "LightManager");
@@ -229,5 +229,5 @@
 /**
    \brief standard deconstructor
-   
+
    first disables Lighting
 
@@ -235,8 +235,8 @@
    and in the end sets the singleton Reference to zero.
 */
-LightManager::~LightManager () 
+LightManager::~LightManager ()
 {
   glDisable(GL_LIGHTING);
-  
+
   // this will be done either by worldEntity, or by pNode as each light is one of them
   //  for (int i = 0; i < NUMBEROFLIGHTS; i++)
@@ -270,5 +270,5 @@
   for (int i = 0; i < NUMBEROFLIGHTS; i++)
     if (!this->lights[i])
-      return addLight(i); 
+      return addLight(i);
   PRINTF(1)("no more light slots availiable. All %d already taken\n", NUMBEROFLIGHTS);
   return -1;
@@ -302,5 +302,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
       return;
@@ -316,5 +316,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(1)("no Light defined yet. So you cannot delete any Light right now.\n");
       return;
@@ -392,5 +392,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
       return;
@@ -409,5 +409,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
       return;
@@ -426,5 +426,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
       return;
@@ -443,5 +443,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
       return;
@@ -458,5 +458,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
       return;
@@ -473,5 +473,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet. Please define at least one light first befor editing.\n");
       return;
@@ -488,5 +488,5 @@
 {
   if (!this->currentLight)
-    { 
+    {
       PRINTF(2)("no Light defined yet\n");
       return Vector(.0, .0, .0);
@@ -498,5 +498,5 @@
 
 /**
-   \returns the Position of Light 
+   \returns the Position of Light
    \param lightNumber lightnumber
 */
@@ -539,5 +539,5 @@
     if (this->lights[i])
       {
-	this->lights[i]->debug();
+        this->lights[i]->debug();
       }
   PRINT(0)("--------------------------------\n");
Index: orxonox/trunk/src/lib/graphics/text_engine.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/text_engine.cc	(revision 4584)
+++ orxonox/trunk/src/lib/graphics/text_engine.cc	(revision 4597)
@@ -1,3 +1,3 @@
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -16,5 +16,5 @@
 
    !! IMPORTANT !! When using ttf fonts clear the license issues prior to
-   adding them to orxonox. This is really important, because we do not 
+   adding them to orxonox. This is really important, because we do not
    want to offend anyone.
 */
@@ -46,5 +46,5 @@
    \param type The renderType to display this font in
 
-   this constructor is private, because the user should initialize 
+   this constructor is private, because the user should initialize
    a text with the TextEngine.
 */
@@ -68,5 +68,5 @@
 /**
    \brief deletes a Text out of memory
-   
+
    This also ereases the text from the textList of the TextEngine
 */
@@ -117,11 +117,11 @@
       char* tmpText = this->text;
       while (*tmpText != '\0')
-	{
-	  if(glyphArray[*tmpText])
-	    {
-	      width += glyphArray[*tmpText]->width;
-	    }
-	  tmpText++;
-	}
+        {
+          if(glyphArray[*tmpText])
+            {
+              width += glyphArray[*tmpText]->width;
+            }
+          tmpText++;
+        }
       this->posSize.w = width;
     }
@@ -174,6 +174,6 @@
   if (likely(this->font != NULL))
     tmpSurf = TTF_RenderText_Blended(this->font->font,
-				     this->text,
-				     this->color);
+                                     this->text,
+                                     this->color);
   if (tmpSurf)
     this->texture = loadTexture(tmpSurf, &this->texCoord);
@@ -208,5 +208,5 @@
       pos.z = tmp[2];
     }
-  else 
+  else
     {
       pos.x = this->posSize.x;
@@ -232,17 +232,17 @@
       glEnable(GL_TEXTURE_2D);
       glBegin(GL_QUADS);
-      
+
       glTexCoord2f(this->texCoord.minU, this->texCoord.minV);
       glVertex2f(pos.x,   pos.y  );
-      
+
       glTexCoord2f(this->texCoord.maxU, this->texCoord.minV);
       glVertex2f(pos.x + this->posSize.w, pos.y  );
-      
+
       glTexCoord2f(this->texCoord.maxU, this->texCoord.maxV);
       glVertex2f(pos.x + this->posSize.w, pos.y + this->posSize.h);
-      
+
       glTexCoord2f(this->texCoord.minU, this->texCoord.maxV);
       glVertex2f(pos.x, pos.y + this->posSize.h);
-      
+
       glEnd();
     }
@@ -257,12 +257,12 @@
       char* tmpText = this->text;
       while (*tmpText != '\0')
-	{
-	  if(glyphArray[*tmpText])
-	    {
-	      glCallList(glyphArray[*tmpText]->displayList);
-	      glTranslatef(glyphArray[*tmpText]->width, 0, 0);
-	    }
-	  tmpText++;
-	}
+        {
+          if(glyphArray[*tmpText])
+            {
+              glCallList(glyphArray[*tmpText]->displayList);
+              glTranslatef(glyphArray[*tmpText]->width, 0, 0);
+            }
+          tmpText++;
+        }
     }
   glPopMatrix();
@@ -299,5 +299,5 @@
   Uint32 saved_flags;
   Uint8  saved_alpha;
-  
+
   /* Use the surface width and height expanded to powers of 2 */
   w = powerOfTwo(surface->w);
@@ -311,22 +311,22 @@
     }
   image = SDL_CreateRGBSurface(SDL_SWSURFACE,
-			       w, h,
-			       32,
+                               w, h,
+                               32,
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
-			       0x000000FF, 
-			       0x0000FF00, 
-			       0x00FF0000, 
-			       0xFF000000
+                               0x000000FF,
+                               0x0000FF00,
+                               0x00FF0000,
+                               0xFF000000
 #else
-			       0xFF000000,
-			       0x00FF0000, 
-			       0x0000FF00, 
-			       0x000000FF
+                               0xFF000000,
+                               0x00FF0000,
+                               0x0000FF00,
+                               0x000000FF
 #endif
-			       );
+                               );
   if ( image == NULL ) {
     return 0;
   }
-  
+
   /* Save the alpha blending attributes */
   saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
@@ -335,5 +335,5 @@
     SDL_SetAlpha(surface, 0, 0);
   }
-  
+
   /* Copy the surface into the GL texture image */
   area.x = 0;
@@ -342,10 +342,10 @@
   area.h = surface->h;
   SDL_BlitSurface(surface, &area, image, &area);
-  
+
   /* Restore the alpha blending attributes */
   if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
     SDL_SetAlpha(surface, saved_flags, saved_alpha);
   }
-  
+
   /* Create an OpenGL texture for the image */
   glGenTextures(1, &texture);
@@ -354,18 +354,18 @@
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexImage2D(GL_TEXTURE_2D,
-	       0,
-	       GL_RGBA,
-	       w, h,
-	       0,
-	       GL_RGBA,
-	       GL_UNSIGNED_BYTE,
-	       image->pixels);
+               0,
+               GL_RGBA,
+               w, h,
+               0,
+               GL_RGBA,
+               GL_UNSIGNED_BYTE,
+               image->pixels);
   SDL_FreeSurface(image); /* No longer needed */
-  
+
   return texture;
 }
 
 /**
-   \brief Quick utility function for texture creation 
+   \brief Quick utility function for texture creation
    \param input an integer
    \returns the next bigger 2^n-integer than input
@@ -374,5 +374,5 @@
 {
   int value = 1;
-  
+
   while ( value < input ) {
     value <<= 1;
@@ -395,10 +395,11 @@
 Font::Font(const char* fontFile, unsigned int fontSize, Uint8 r, Uint8 g, Uint8 b)
 {
+  this->setClassID(CL_FONT, "Font");
   // setting default values.
   this->font = NULL;
   this->fontFile = NULL;
   this->glyphArray = NULL;
-  this->fastTextureID = 0;  
-  
+  this->fastTextureID = 0;
+
   this->setSize(fontSize);
 
@@ -423,5 +424,5 @@
     {
       for (int i = 0; i < FONT_HIGHEST_KNOWN_CHAR; i++)
-	delete this->glyphArray[i];
+        delete this->glyphArray[i];
       delete []this->glyphArray;
     }
@@ -441,15 +442,16 @@
   if (!this->fontFile)
     {
+      this->setName(fontFile);
       this->fontFile = new char[strlen(fontFile)+1];
       strcpy(this->fontFile, fontFile);
-      
+
       this->font = TTF_OpenFont(this->fontFile, this->fontSize);
       if(!this->font)
-	{
-	  PRINTF(1)("TTF_OpenFont: %s\n", TTF_GetError());
-	  return false;
-	}
+        {
+          PRINTF(1)("TTF_OpenFont: %s\n", TTF_GetError());
+          return false;
+        }
       else
-	  return true;
+          return true;
     }
   else
@@ -468,11 +470,11 @@
 {
   this->renderStyle = TTF_STYLE_NORMAL;
-  
+
   for (int i = 0; i < strlen(renderStyle); i++)
-    if (strncmp(renderStyle+i, "b", 1) == 0) 
+    if (strncmp(renderStyle+i, "b", 1) == 0)
       this->renderStyle |= TTF_STYLE_BOLD;
     else if (strncmp(renderStyle+i, "i", 1) == 0)
       this->renderStyle |= TTF_STYLE_ITALIC;
-    else if (strncmp(renderStyle+i, "u", 1) == 0) 
+    else if (strncmp(renderStyle+i, "u", 1) == 0)
       this->renderStyle |= TTF_STYLE_UNDERLINE;
 
@@ -547,5 +549,5 @@
    and MUST be deleted by the user..
 
-   This only works for horizontal fonts. see 
+   This only works for horizontal fonts. see
    http://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
    for more info about vertical Fonts
@@ -557,7 +559,7 @@
   if (likely (this->font!= NULL))
     TTF_GlyphMetrics(this->font, rg->character,
-		     &rg->minX, &rg->maxX,
-		     &rg->minY, &rg->maxY,
-		     &rg->advance);
+                     &rg->minX, &rg->maxX,
+                     &rg->minY, &rg->maxY,
+                     &rg->advance);
   rg->height = rg->maxY - rg->minY;
   rg->width = rg->maxX - rg->minX;
@@ -569,5 +571,5 @@
 GLuint Font::createFastTexture(void)
 {
-  /* interesting GLYPHS: 
+  /* interesting GLYPHS:
    *  32: space
    *  33-47: Special Characters.
@@ -589,18 +591,18 @@
   SDL_Rect tmpRect; // this represents a Rectangle for blitting.
   SDL_Surface* tmpSurf =  SDL_CreateRGBSurface(SDL_SWSURFACE,
-					       rectSize, rectSize,
-					       32,
+                                               rectSize, rectSize,
+                                               32,
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
-					       0x000000FF, 
-					       0x0000FF00, 
-					       0x00FF0000, 
-					       0xFF000000
+                                               0x000000FF,
+                                               0x0000FF00,
+                                               0x00FF0000,
+                                               0xFF000000
 #else
-					       0xFF000000,
-					       0x00FF0000, 
-					       0x0000FF00, 
-					       0x000000FF
+                                               0xFF000000,
+                                               0x00FF0000,
+                                               0x0000FF00,
+                                               0x000000FF
 #endif
-					       );
+                                               );
   tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h;
   SDL_SetClipRect(tmpSurf, &tmpRect);
@@ -614,64 +616,64 @@
 
       if (tmpGlyph = this->glyphArray[i])
-	{
-	  if (tmpGlyph->height > maxLineHeight)
-	    maxLineHeight = tmpGlyph->height;
-	  
-	  if (tmpRect.x+tmpGlyph->width > tmpSurf->w)
-	    {
-	      tmpRect.x = 0;
-	      tmpRect.y = tmpRect.y + maxLineHeight + 1;
-	      maxLineHeight = 0;
-	    }
-	  if (tmpRect.y + maxLineHeight > tmpSurf->h)
-	    {
-	      PRINTF(1)("Protection, so font cannot write over the boundraries error (this should not heappen\n");
-	      break;
-	    }
-	  // reading in the new Glyph
-	  if (likely(this->font != NULL))
-	    glyphSurf = TTF_RenderGlyph_Blended(this->font, i, this->fastColor);
-	  if( glyphSurf != NULL )
-	    {
-
-	      SDL_SetAlpha(glyphSurf, 0, 0);
-
-	      SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect);
-	      TexCoord tmpTexCoord;
-	      tmpTexCoord.minU = (float)tmpRect.x/(float)tmpSurf->w;
-	      tmpTexCoord.maxU = (float)(tmpRect.x+tmpGlyph->width)/(float)tmpSurf->w;
-	      tmpTexCoord.minV = (float)tmpRect.y/(float)tmpSurf->w;
-	      tmpTexCoord.maxV = (float)(tmpRect.y+tmpGlyph->height)/(float)tmpSurf->w;
-	      tmpGlyph->displayList = glGenLists(1);
-
-	      glNewList(tmpGlyph->displayList, GL_COMPILE);
-	      glBegin(GL_QUADS);
-	      glTexCoord2f(tmpTexCoord.minU, tmpTexCoord.minV);
-	      glVertex2d(0, 0);
-	      glTexCoord2f(tmpTexCoord.minU, tmpTexCoord.maxV);
-	      glVertex2d(0, tmpGlyph->height);
-	      glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.maxV);
-	      glVertex2d(tmpGlyph->width, tmpGlyph->height);
-	      glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.minV);
-	      glVertex2d(tmpGlyph->width, 0);
-	      glEnd();
-	      glEndList();
-	      SDL_FreeSurface(glyphSurf);
-
-	      tmpRect.x += tmpGlyph->width + 1;
-
-	      // Outputting Glyphs to BMP-files.
-	      /*
-		char outname[64];
-		if (i < 10)
-		sprintf( outname, "glyph-00%d.bmp", i );
-		else if (i <100)
-		sprintf( outname, "glyph-0%d.bmp", i );
-		else
-		sprintf( outname, "glyph-%d.bmp", i );
-		SDL_SaveBMP(tmpSurf, outname);
-	      */
-	    }
-	}
+        {
+          if (tmpGlyph->height > maxLineHeight)
+            maxLineHeight = tmpGlyph->height;
+
+          if (tmpRect.x+tmpGlyph->width > tmpSurf->w)
+            {
+              tmpRect.x = 0;
+              tmpRect.y = tmpRect.y + maxLineHeight + 1;
+              maxLineHeight = 0;
+            }
+          if (tmpRect.y + maxLineHeight > tmpSurf->h)
+            {
+              PRINTF(1)("Protection, so font cannot write over the boundraries error (this should not heappen\n");
+              break;
+            }
+          // reading in the new Glyph
+          if (likely(this->font != NULL))
+            glyphSurf = TTF_RenderGlyph_Blended(this->font, i, this->fastColor);
+          if( glyphSurf != NULL )
+            {
+
+              SDL_SetAlpha(glyphSurf, 0, 0);
+
+              SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect);
+              TexCoord tmpTexCoord;
+              tmpTexCoord.minU = (float)tmpRect.x/(float)tmpSurf->w;
+              tmpTexCoord.maxU = (float)(tmpRect.x+tmpGlyph->width)/(float)tmpSurf->w;
+              tmpTexCoord.minV = (float)tmpRect.y/(float)tmpSurf->w;
+              tmpTexCoord.maxV = (float)(tmpRect.y+tmpGlyph->height)/(float)tmpSurf->w;
+              tmpGlyph->displayList = glGenLists(1);
+
+              glNewList(tmpGlyph->displayList, GL_COMPILE);
+              glBegin(GL_QUADS);
+              glTexCoord2f(tmpTexCoord.minU, tmpTexCoord.minV);
+              glVertex2d(0, 0);
+              glTexCoord2f(tmpTexCoord.minU, tmpTexCoord.maxV);
+              glVertex2d(0, tmpGlyph->height);
+              glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.maxV);
+              glVertex2d(tmpGlyph->width, tmpGlyph->height);
+              glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.minV);
+              glVertex2d(tmpGlyph->width, 0);
+              glEnd();
+              glEndList();
+              SDL_FreeSurface(glyphSurf);
+
+              tmpRect.x += tmpGlyph->width + 1;
+
+              // Outputting Glyphs to BMP-files.
+              /*
+                char outname[64];
+                if (i < 10)
+                sprintf( outname, "glyph-00%d.bmp", i );
+                else if (i <100)
+                sprintf( outname, "glyph-0%d.bmp", i );
+                else
+                sprintf( outname, "glyph-%d.bmp", i );
+                SDL_SaveBMP(tmpSurf, outname);
+              */
+            }
+        }
     }
 
@@ -682,11 +684,11 @@
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexImage2D(GL_TEXTURE_2D,
-	       0,
-	       GL_RGBA,
-	       tmpSurf->w, tmpSurf->h,
-	       0,
-	       GL_RGBA,
-	       GL_UNSIGNED_BYTE,
-	       tmpSurf->pixels);
+               0,
+               GL_RGBA,
+               tmpSurf->w, tmpSurf->h,
+               0,
+               GL_RGBA,
+               GL_UNSIGNED_BYTE,
+               tmpSurf->pixels);
   SDL_FreeSurface(tmpSurf);
   return texture;
@@ -707,9 +709,9 @@
       this->glyphArray = new Glyph*[FONT_HIGHEST_KNOWN_CHAR];
       for (int i = 0; i < FONT_HIGHEST_KNOWN_CHAR; i++)
-	this->glyphArray[i] = NULL;
-    }
-  
+        this->glyphArray[i] = NULL;
+    }
+
   Uint16 lastGlyph = from + count;
-  
+
   for (int i = from; i <= lastGlyph; i++)
     {
@@ -723,8 +725,8 @@
    \returns the optimal size to use as the texture size
 
-   \todo: this algorithm can be a lot more faster, althought it does 
+   \todo: this algorithm can be a lot more faster, althought it does
    not really matter within the init-context, and 128 glyphs.
 
-   This function searches for a 2^n sizes texture-size, this is for 
+   This function searches for a 2^n sizes texture-size, this is for
    openGL-version < 1.2 compatibility ( and because it is realy easy like this :))
 */
@@ -743,27 +745,27 @@
       maxLineHeight = 0;
       for (i = 0; i < FONT_HIGHEST_KNOWN_CHAR; i++)
-	{
-	  if(tmpGlyph = this->glyphArray[i])
-	    {
-	      // getting the height of the highest Glyph in the Line.
-	      if (tmpGlyph->height > maxLineHeight)
-		maxLineHeight = tmpGlyph->height;
-
-	      if (x + tmpGlyph->width > size)
-		{
-		  x = 0;
-		  y = y + maxLineHeight;
-		  maxLineHeight = 0;
-		}
-	      if (y + maxLineHeight + 1 > size)
-		break;
-	      x += tmpGlyph->width + 1;
-
-	    }
-	}
+        {
+          if(tmpGlyph = this->glyphArray[i])
+            {
+              // getting the height of the highest Glyph in the Line.
+              if (tmpGlyph->height > maxLineHeight)
+                maxLineHeight = tmpGlyph->height;
+
+              if (x + tmpGlyph->width > size)
+                {
+                  x = 0;
+                  y = y + maxLineHeight;
+                  maxLineHeight = 0;
+                }
+              if (y + maxLineHeight + 1 > size)
+                break;
+              x += tmpGlyph->width + 1;
+
+            }
+        }
       if (i == FONT_HIGHEST_KNOWN_CHAR)
-	sizeOK = true;
+        sizeOK = true;
       else
-	size *= 2;
+        size *= 2;
     }
   return size;
@@ -801,7 +803,8 @@
    \brief standard constructor
 */
-TextEngine::TextEngine () 
+TextEngine::TextEngine ()
 {
    this->setClassID(CL_TEXT_ENGINE, "TextEngine");
+   this->setName("TextEngine");
    this->enableFonts();
 
@@ -818,8 +821,8 @@
 
 */
-TextEngine::~TextEngine () 
+TextEngine::~TextEngine ()
 {
   this->disableFonts();
-  
+
   delete this->textList;
 
@@ -835,5 +838,5 @@
     {
       if(TTF_Init()==-1)
-	PRINTF(1)("TTF_Init: %s\n", TTF_GetError());
+        PRINTF(1)("TTF_Init: %s\n", TTF_GetError());
 
       TextEngine::checkVersion();
@@ -932,5 +935,5 @@
 /**
    \brief outputs some nice Debug information
-   
+
    \todo there should also be something outputted about Font
 */
@@ -941,5 +944,5 @@
   PRINT(0)("+-------------------------------+\n");
   PRINT(0)("Reference: %p; Text Counts: %d\n", this, this->textList->getSize());
-  
+
   tIterator<Text>* textIterator = textList->getIterator();
   Text* text = textIterator->nextElement();
@@ -973,13 +976,13 @@
   else
     {
-      PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n", 
-		compile_version.major,
-		compile_version.minor,
-		compile_version.patch);
-      
-      PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n", 
-		link_version.major,
-		link_version.minor,
-		link_version.patch);
+      PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n",
+                compile_version.major,
+                compile_version.minor,
+                compile_version.patch);
+
+      PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n",
+                link_version.major,
+                link_version.minor,
+                link_version.patch);
       return false;
     }
Index: orxonox/trunk/src/lib/graphics/text_engine.h
===================================================================
--- orxonox/trunk/src/lib/graphics/text_engine.h	(revision 4584)
+++ orxonox/trunk/src/lib/graphics/text_engine.h	(revision 4597)
@@ -1,3 +1,3 @@
-/*! 
+/*!
     \file text_engine.h
     \brief Definition of textEngine, the Font and the Text
@@ -30,12 +30,15 @@
 
 //! An enumerator for the text alignment.
-enum TEXT_ALIGNMENT { TEXT_ALIGN_LEFT,
-		      TEXT_ALIGN_RIGHT,
-		      TEXT_ALIGN_CENTER,
-		      TEXT_ALIGN_SCREEN_CENTER };
+ enum TEXT_ALIGNMENT
+{
+  TEXT_ALIGN_LEFT,
+  TEXT_ALIGN_RIGHT,
+  TEXT_ALIGN_CENTER,
+  TEXT_ALIGN_SCREEN_CENTER
+};
 
 /* some default values */
 #define FONT_DEFAULT_SIZE       50                   //!< default size of the Text
-#define FONT_DEFAULT_TEXT	"orxonox 1234567890" //!< default text to display
+#define FONT_DEFAULT_TEXT       "orxonox 1234567890" //!< default text to display
 #define FONT_DEFAULT_COLOR_R    255                  //!< default red part (color) of the text
 #define FONT_DEFAULT_COLOR_G    255                  //!< default red green (color) of the text
@@ -86,5 +89,5 @@
   int      bearingY;          //!< How much is above the Origin
   int      advance;           //!< How big a Glyph would be in monospace-mode
-  
+
   // OpenGL-specific
   //  TexCoord texCoord;      //!< A Texture Coordinate for this glyph.
@@ -117,10 +120,10 @@
 
   void draw(void) const;
-  
+
   void debug(void) const;
 
  private:
   Text(Font* font, int type = TEXT_DYNAMIC);
-  
+
   static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
   static int powerOfTwo(int input);
@@ -139,5 +142,5 @@
   TexCoord          texCoord;       //!< Texture-coordinates \todo fix this to have a struct
   SDL_Rect          posSize;        //!< An SDL-Rectangle representing the position and size of the Text on the screen.
-  
+
   PNode*            bindNode;       //!< A node the Text is bind to. (if NULL thr node will not be bound to anything.)
 };
@@ -147,5 +150,5 @@
 ////////////
 //! A class to handle a Font of a certain ttf-File, Size and Color.
-class Font
+class Font : public BaseObject
 {
   friend class Text;
@@ -170,5 +173,5 @@
   /** \returns the texture to the fast-texture */
   inline GLuint getFastTextureID(void) const {return fastTextureID;}
-  
+
  private:
   int getMaxHeight(void);
@@ -193,5 +196,5 @@
   unsigned int  fontSize;            //!< The size of the font in pixels. each Font has one size.
   int           renderStyle;         //!< The Renderstyle
-  
+
   Glyph**       glyphArray;          //!< An Array of all the Glyphs stored in the Array of Glyphs.
   GLuint        fastTextureID;       //!< The fast textureID.
@@ -205,5 +208,5 @@
 ///////////////////
 //! A singleton Class that operates as a Handler for generating and rendering Text in 2D
-class TextEngine : public BaseObject 
+class TextEngine : public BaseObject
 {
  public:
@@ -213,15 +216,15 @@
 
   Text* createText(const char* fontFile,
-		   unsigned int fontSize = FONT_DEFAULT_SIZE,
-		   int textType = TEXT_DYNAMIC,
-		   Uint8 r = FONT_DEFAULT_COLOR_R,
-		   Uint8 g = FONT_DEFAULT_COLOR_G,
-		   Uint8 b = FONT_DEFAULT_COLOR_B);
-  
+                   unsigned int fontSize = FONT_DEFAULT_SIZE,
+                   int textType = TEXT_DYNAMIC,
+                   Uint8 r = FONT_DEFAULT_COLOR_R,
+                   Uint8 g = FONT_DEFAULT_COLOR_G,
+                   Uint8 b = FONT_DEFAULT_COLOR_B);
+
   void deleteText(Text* text);
   void flush(void);
 
   void draw(void) const;
- 
+
   void debug(void) const;
 
