Index: trunk/src/lib/graphics/importer/Makefile.am
===================================================================
--- trunk/src/lib/graphics/importer/Makefile.am	(revision 8362)
+++ trunk/src/lib/graphics/importer/Makefile.am	(revision 8363)
@@ -11,15 +11,17 @@
                            primitive_model.cc \
                            md2Model.cc \
-                           material.cc \
-                           texture.cc \
-                           texture_sequence.cc \
                            height_map.cc \
-                           media_container.cc \
-                           movie_player.cc \
-                           \
                            bsp_manager.cc \
                            bsp_file.cc \
                            bsp_tree_node.cc \
-                           bsp_tree_leaf.cc
+                           bsp_tree_leaf.cc \
+                           \
+                           material.cc \
+                           texture.cc \
+                           texture_data.cc \
+                           texture_sequence.cc \
+                           media_container.cc \
+                           movie_player.cc
+
 
 
@@ -37,10 +39,13 @@
 		primitive_model.h \
 		md2Model.h \
+		anorms.h \
+		anormtab.h \
+		height_map.h \
+		\
 		material.h \
 		texture.h \
+		texture_data.h \
 		texture_sequence.h \
-		height_map.h \
-		anorms.h \
-		anormtab.h \
+		\
 		media_container.h \
 		movie_player.h\
Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 8362)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 8363)
@@ -37,112 +37,52 @@
  */
 Uint32 alphaMask[] = {
-	0xFF000000,
-	0x00FF0000,
-	0x0000FF00,
-	0x000000FF,
-};
+                       0xFF000000,
+                       0x00FF0000,
+                       0x0000FF00,
+                       0x000000FF,
+                     };
 
 Uint32 opaqueMask[] = {
-	0x00FF0000,
-	0x0000FF00,
-	0x000000FF,
-	0xFF000000
-};
+                        0x00FF0000,
+                        0x0000FF00,
+                        0x000000FF,
+                        0xFF000000
+                      };
 #else
 /*
- * On the LIL_ENDIAN architecture everything is fine and easy. The 24
- * and 32bit bitmaps have the same masks.
- */
+* On the LIL_ENDIAN architecture everything is fine and easy. The 24
+* and 32bit bitmaps have the same masks.
+*/
 Uint32 alphaMask[] = {
-	0x000000FF,
-	0x0000FF00,
-	0x00FF0000,
-	0xFF000000,
-};
+                       0x000000FF,
+                       0x0000FF00,
+                       0x00FF0000,
+                       0xFF000000,
+                     };
 
 Uint32 *opaqueMask = alphaMask;
-
 #endif
 
-TextureData::TextureData()
-{
-  this->bAlpha = false;
-  this->texture = 0;
-  this->image = NULL;
-}
-
-
-/**
- * @brief Destructor of a Texture
+
+
+/**
+ * @brief creates an Empty Texture,
  *
- *  Frees Data, and deletes the textures from GL
- */
-TextureData::~TextureData()
-{
-  if (this->texture != 0)
-    glDeleteTextures(1, &this->texture);
-  if (this->image != NULL)
-    SDL_FreeSurface(this->image);
-}
-
-
-/**
- * @brief Loads an SDL_Surface.
- */
-bool TextureData::loadSurface(SDL_Surface* surface, GLenum target)
-{
-  if (Texture::getTextureEnableState())
-  {
-    SDL_Surface* newSurf = Texture::prepareSurface(surface, this->bAlpha);
-    if (newSurf != NULL)
-    {
-      this->setSurface(newSurf);
-      this->setTexture(Texture::loadTexToGL(newSurf, target));
-      return true;
-    }
-  }
-  return false;
-}
-
-
-
-/**
- * @brief set the surface this Texture handles
- * @param newSurface the new Surface to set as the image for this Texture.
+ * onto this Texture you can load non-empty textures with the =
+ * operator.
+ */
+Texture::Texture()
+{
+  this->init();
+}
+
+/**
+ * @brief Creates a Texture from another Texture (copy Constructor)
+ * @param texture the Texture to copy.
  *
- * This deletes the old version of the stored Texture,
- * and sets the newly given Surface as current.
- */
-bool TextureData::setSurface(SDL_Surface* newSurface)
-{
-  if (this->image != NULL)
-    SDL_FreeSurface(this->image);
-
-  this->image = newSurface;
-
-  return (this->image != NULL);
-}
-
-
-
-bool TextureData::setTexture(GLuint texture)
-{
-     // unload the old Texture.
-  if (this->texture != 0 && glIsTexture(this->getTexture()))
-  {
-    glDeleteTextures(1, &this->texture);
-  }
-  this->texture = texture;
-  return (texture != 0);
-}
-
-Texture::Texture()
-{
-  this->init();
-}
-
-
+ * @note only the Data-Pointer will be shared.
+ */
 Texture::Texture(const Texture& texture)
-  : data(texture.data)
+    : data(texture.data)
 {
   this->setClassID(CL_TEXTURE, "Texture");
@@ -150,29 +90,24 @@
 }
 
-
+/**
+ * @brief Creates a new empty Texture with the below properties.
+ * @param target: the GL-Target.
+ * @param width: the Width of the Texture.
+ * @param height: The Hight of the Texture.
+ * @param channels: also known as BitsPerPixel.
+ * @param type the Type of Texture.
+ */
 Texture::Texture(GLenum target, unsigned int width, unsigned int height, unsigned int channels, GLenum type)
 {
   this->init();
-  GLuint texture = 0;
-  Texture::generateTexture(texture, target);
-
-  glBindTexture(target, texture);
-
-  unsigned int* pixels = new unsigned int[width * height * channels];
-  memset(pixels, 0, width * height * channels * sizeof(unsigned int));
-
-
-  glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
-  glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
-  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
-  glTexImage2D(target, 0, channels, width, height, 0, type, GL_UNSIGNED_INT, pixels);
-
-
-
-  delete[] pixels;
-
-  this->data->setTexture(texture);
+
+  SDL_Surface * surface = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, channels,
+                          alphaMask[0], alphaMask[1], alphaMask[2], alphaMask[3]);
+
+  if(surface != NULL)
+  {
+    this->data->loadSurface(surface, target);
+    SDL_FreeSurface(surface);
+  }
 }
 
@@ -218,6 +153,5 @@
  */
 Texture::~Texture()
-{
-}
+{}
 
 
@@ -308,5 +242,5 @@
   int pixelDepth = 24;
 
-	Uint32* mask = opaqueMask;
+  Uint32* mask = opaqueMask;
 
   /* Save the alpha blending attributes */
@@ -318,5 +252,5 @@
     hasAlpha = true;
     pixelDepth = 32;
-		mask = alphaMask;
+    mask = alphaMask;
   }
 
@@ -324,5 +258,5 @@
                                     surface->w, surface->h,
                                     pixelDepth,
-																		mask[0], mask[1], mask[2], mask[3] );
+                                    mask[0], mask[1], mask[2], mask[3] );
   if ( retSurface == NULL )
     return NULL;
@@ -377,11 +311,11 @@
   Texture::generateTexture(texture, target);
 
-//   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);
+  //   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);
 
   /// TODO CHECK THIS BACK in
Index: trunk/src/lib/graphics/importer/texture.h
===================================================================
--- trunk/src/lib/graphics/importer/texture.h	(revision 8362)
+++ trunk/src/lib/graphics/importer/texture.h	(revision 8363)
@@ -11,36 +11,9 @@
 #include "glincl.h"
 #include "count_pointer.h"
+#include "texture_data.h"
+
 
 /* Forward Declaration */
 struct SDL_Surface;
-
-
-class TextureData
-{
-  public:
-    TextureData();
-    ~TextureData();
-
-    inline GLuint getTexture() const { return this->texture; };
-    /** @returns true if texture has alpha, false otherwise */
-    inline bool hasAlpha() const  {return this->bAlpha; }
-    /** @returns the stored image of this Texture */
-    const SDL_Surface* const getStoredImage() const { return this->image; };
-
-    bool loadSurface(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
-
-    bool rebuild();
-
-    bool setSurface(SDL_Surface* newSurface);
-    /** @returns true if the Surface has an Alpha Value. */
-    bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; return this->bAlpha; };
-    bool setTexture(GLuint texture);
-
-  private:
-    GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
-    bool             bAlpha;             //!< if the texture has an alpha channel.
-    SDL_Surface*     image;              //!< The SDL_Surfce that stores the Texture on it.
-};
-
 
 //! A Class, that reads in Textures from different fileformats.
Index: trunk/src/lib/graphics/importer/texture_data.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture_data.cc	(revision 8363)
+++ trunk/src/lib/graphics/importer/texture_data.cc	(revision 8363)
@@ -0,0 +1,106 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
+
+#include "texture.h"
+
+#include "debug.h"
+#include "compiler.h"
+
+#include "sdlincl.h"
+
+/**
+ * @brief creates a new Texture Data.
+ */
+TextureData::TextureData()
+{
+  this->bAlpha = false;
+  this->texture = 0;
+  this->image = NULL;
+}
+
+
+/**
+ * @brief Destructor of a Texture
+ *
+ *  Frees Data, and deletes the textures from GL
+ */
+TextureData::~TextureData()
+{
+  if (this->texture != 0)
+    glDeleteTextures(1, &this->texture);
+  if (this->image != NULL)
+    SDL_FreeSurface(this->image);
+}
+
+
+/**
+ * @brief Loads an SDL_Surface.
+ * @param surface the Surface to Load.
+ * @param target the GL-Target to load the Surface to default GL_TEXTURE_2D
+ * @returns true on success, false otherwise.
+ */
+bool TextureData::loadSurface(SDL_Surface* surface, GLenum target)
+{
+  if (Texture::getTextureEnableState())
+  {
+    SDL_Surface* newSurf = Texture::prepareSurface(surface, this->bAlpha);
+    if (newSurf != NULL)
+    {
+      this->setSurface(newSurf);
+      this->setTexture(Texture::loadTexToGL(newSurf, target));
+      return true;
+    }
+  }
+  return false;
+}
+
+
+
+/**
+ * @brief set the surface this Texture handles
+ * @param newSurface the new Surface to set as the image for this Texture.
+ * @returns true on success.
+ *
+ * This deletes the old version of the stored Texture,
+ * and sets the newly given Surface as current.
+ */
+bool TextureData::setSurface(SDL_Surface* newSurface)
+{
+  if (this->image != NULL)
+    SDL_FreeSurface(this->image);
+
+  this->image = newSurface;
+
+  return (this->image != NULL);
+}
+
+
+/**
+ * @brief sets a new Texture to the Data.
+ * @param texture the Texture
+ * @returns true on success.
+ */
+bool TextureData::setTexture(GLuint texture)
+{
+     // unload the old Texture.
+  if (this->texture != 0 && glIsTexture(this->getTexture()))
+  {
+    glDeleteTextures(1, &this->texture);
+  }
+  this->texture = texture;
+  return (texture != 0);
+}
Index: trunk/src/lib/graphics/importer/texture_data.h
===================================================================
--- trunk/src/lib/graphics/importer/texture_data.h	(revision 8363)
+++ trunk/src/lib/graphics/importer/texture_data.h	(revision 8363)
@@ -0,0 +1,45 @@
+/*!
+ * @file texture.h
+ * @brief Contains the texture class, that handles the reading of Images into Texutre-files.
+ */
+
+#ifndef _TEXTURE_DATA_H
+#define _TEXTURE_DATA_H
+
+#include "base_object.h"
+
+#include "glincl.h"
+#include "count_pointer.h"
+
+/* Forward Declaration */
+struct SDL_Surface;
+
+
+class TextureData
+{
+  public:
+    TextureData();
+    ~TextureData();
+
+    inline GLuint getTexture() const { return this->texture; };
+    /** @returns true if texture has alpha, false otherwise */
+    inline bool hasAlpha() const  {return this->bAlpha; }
+    /** @returns the stored image of this Texture */
+    const SDL_Surface* const getStoredImage() const { return this->image; };
+
+    bool loadSurface(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
+
+    bool rebuild();
+
+    bool setSurface(SDL_Surface* newSurface);
+    /** @returns true if the Surface has an Alpha Value. */
+    bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; return this->bAlpha; };
+    bool setTexture(GLuint texture);
+
+  private:
+    GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
+    bool             bAlpha;             //!< if the texture has an alpha channel.
+    SDL_Surface*     image;              //!< The SDL_Surfce that stores the Texture on it.
+};
+
+#endif /* _TEXTURE_DATA_H */
