Index: /trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- /trunk/src/lib/graphics/graphics_engine.cc	(revision 7726)
+++ /trunk/src/lib/graphics/graphics_engine.cc	(revision 7727)
@@ -210,5 +210,5 @@
 
   // setting the Video Flags.
-  this->videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE | SDL_DOUBLEBUF | SDL_GL_DOUBLEBUFFER;
+  this->videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE ;
 
   /* query SDL for information about our video hardware */
@@ -281,4 +281,10 @@
   SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
   SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
+
+  SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);	//Use at least 5 bits of Red
+  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);	//Use at least 5 bits of Green
+  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);	//Use at least 5 bits of Blue
+  SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);	//Use at least 16 bits for the depth buffer
+  SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);  //Enable double buffering
 }
 
Index: /trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- /trunk/src/lib/graphics/importer/texture.cc	(revision 7726)
+++ /trunk/src/lib/graphics/importer/texture.cc	(revision 7727)
@@ -30,5 +30,5 @@
 
 /**
- *  Constructor for a Texture
+ * @brief Constructor for a Texture
 */
 Texture::Texture(const std::string& imageName, GLenum target)
@@ -50,8 +50,8 @@
 
 /**
- *  Destructor of a Texture
-
-   Frees Data, and deletes the textures from GL
-*/
+ * @brief Destructor of a Texture
+ *
+ * Frees Data, and deletes the textures from GL
+ */
 Texture::~Texture()
 {
@@ -64,5 +64,5 @@
 
 /**
- *  loads an Image from a file to a Texture
+ * @brief loads an Image from a file to a Texture
  * @param imageName The image to load
 */
@@ -121,5 +121,6 @@
 
 /**
- * rebuilds the texture.
+ * @brief rebuilds the texture.
+ *
  * reloads the Texture from Memory to OpenGL.
  */
@@ -142,5 +143,5 @@
 
 /**
- * set the surface this Texture handles
+ * @brief set the surface this Texture handles
  * @param newSurface the new Surface to set as the image for this Texture.
  *
@@ -162,5 +163,5 @@
 
 /**
- * enables, disables textures
+ * @brief enables, disables textures
  * @param texturesEnabled true if the textures should be enabled
  */
@@ -175,5 +176,5 @@
 //////////////////////////////////////
 /**
- * converts surface to a new SDL_Surface, that is loadable by openGL
+ * @brief converts surface to a new SDL_Surface, that is loadable by openGL
  * @param surface the Surface to convert
  * @param hasAlpha if the newly created Surface has an alpha channel, true is returned otherwise false.
@@ -182,4 +183,5 @@
 SDL_Surface* Texture::prepareSurface(SDL_Surface* surface, bool& hasAlpha) const
 {
+  assert(surface != NULL);
   PRINTF(4)("Loading texture to OpenGL-Environment.\n");
 
@@ -190,7 +192,19 @@
 
   hasAlpha = false;
-  retSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
+  int pixelDepth = 24;
+
+  /* Save the alpha blending attributes */
+  saved_flags = surface->flags&(SDL_SRCALPHA | SDL_RLEACCELOK);
+  saved_alpha = surface->format->alpha;
+  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA )
+  {
+    SDL_SetAlpha(surface, 0, 0);
+    hasAlpha = true;
+    pixelDepth = 32;
+  }
+
+  retSurface = SDL_CreateRGBSurface(SDL_HWSURFACE,
                                     surface->w, surface->h,
-                                    32,
+                                    pixelDepth,
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
                                     0x000000FF,
@@ -206,15 +220,5 @@
                                    );
   if ( retSurface == NULL )
-  {
     return NULL;
-  }
-
-  /* Save the alpha blending attributes */
-  saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
-  saved_alpha = surface->format->alpha;
-  if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA )
-  {
-    SDL_SetAlpha(surface, 0, 0);
-  }
 
   /* Copy the surface into the GL texture image */
@@ -237,5 +241,5 @@
 
 /**
- *  Loads a Texture to the openGL-environment.
+ * @brief Loads a Texture to the openGL-environment.
  * @param surface the Image to load to openGL
  * @returns The ID of the texture.
@@ -246,4 +250,5 @@
   //     glDeleteTextures(1, &this->texture);
   //   this->texture = 0;
+  assert(surface != NULL);
 
   int      errorCode = 0;           //!< the error code for the texture loading functions
@@ -252,8 +257,14 @@
   int      mipmapWidth = 0;         //!< the width of the mipmap
   int      mipmapHight = 0;         //!< the height of the mipmap
-
-
-  if (surface == NULL)
-    return 0;
+  GLenum   format = GL_RGB;
+  if (this->bAlpha)
+  {
+    format = GL_RGBA;
+    assert(surface->format->BitsPerPixel == 32);
+  }
+  else
+  {
+    assert(surface->format->BitsPerPixel == 24);
+  }
 
   /* Create an OpenGL texture for the image */
@@ -261,4 +272,9 @@
   glBindTexture(target, texture);
 
+//   glTexImage2D(target,  0,  format,
+//                surface->w,  surface->h,
+//                0, format,  GL_UNSIGNED_BYTE,
+//                surface->pixels);
+
   glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
   glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_REPEAT);
@@ -275,22 +291,11 @@
 
   /* build the Texture  OpenGL V >= 1.1 */
-  glTexImage2D(target,
-               0,
-               GL_RGBA,
-               surface->w,
-               surface->h,
-               0,
-               GL_RGBA,
-               GL_UNSIGNED_BYTE,
-               surface->pixels);
+
   //  printf("%s, w:%d h:%d, 0x%x\n", this->getName(), surface->w, surface->h, target);
 
   // build the MipMaps automaticaly
-  errorCode = gluBuild2DMipmaps(target,
-                                GL_RGBA,
-                                surface->w,
-                                surface->h,
-                                GL_RGBA,
-                                GL_UNSIGNED_BYTE,
+  errorCode = gluBuild2DMipmaps(target, format,
+                                surface->w,  surface->h,
+                                format,  GL_UNSIGNED_BYTE,
                                 surface->pixels
                                );
Index: /trunk/src/lib/graphics/importer/texture.h
===================================================================
--- /trunk/src/lib/graphics/importer/texture.h	(revision 7726)
+++ /trunk/src/lib/graphics/importer/texture.h	(revision 7727)
@@ -43,9 +43,7 @@
 
     protected:
-
       bool setSurface(SDL_Surface* newSurface);
       bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; };
       bool setTexture(GLuint texture) { this->texture = texture; };
-
 
     private:
Index: /trunk/src/lib/graphics/render2D/element_2d.cc
===================================================================
--- /trunk/src/lib/graphics/render2D/element_2d.cc	(revision 7726)
+++ /trunk/src/lib/graphics/render2D/element_2d.cc	(revision 7727)
@@ -123,4 +123,6 @@
   if (this->toDirection != NULL)
     delete this->toDirection;
+  if (this->toSize != NULL)
+    delete this->toSize;
 
   if (this == Element2D::nullElement)
Index: /trunk/src/lib/graphics/text_engine/font.cc
===================================================================
--- /trunk/src/lib/graphics/text_engine/font.cc	(revision 7726)
+++ /trunk/src/lib/graphics/text_engine/font.cc	(revision 7727)
@@ -427,5 +427,5 @@
   // Surface definition.
   SDL_Rect tmpRect; // this represents a Rectangle for blitting.
-  SDL_Surface* tmpSurf =  SDL_CreateRGBSurface(SDL_SWSURFACE,
+  SDL_Surface* tmpSurf =  SDL_CreateRGBSurface(SDL_HWSURFACE,
                           rectSize, rectSize,
                           32,
@@ -494,5 +494,5 @@
 //       sprintf( outName, "%s-glyphs.bmp", this->getName());
 //       SDL_SaveBMP(tmpSurf, outName);
-
+  this->setAlpha(true);
   if (this->setSurface(tmpSurf))
     (this->setTexture(Texture::loadTexToGL(tmpSurf)));
@@ -500,5 +500,5 @@
 
 /**
- *  stores Glyph Metrics in an Array.
+ * @brief stores Glyph Metrics in an Array.
  * @param from The Glyph to start from.
  * @param count The number of Glyphs to start From.
@@ -535,10 +535,10 @@
 /**
  * @returns the optimal size to use as the texture size
-
-   @todo: this algorithm can be a lot 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
-   openGL-version < 1.2 compatibility ( and because it is realy easy like this :))
+ *
+ * @todo: this algorithm can be a lot 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
+ * openGL-version < 1.2 compatibility ( and because it is realy easy like this :))
  */
 int Font::findOptimalFastTextureSize()
