Index: /branches/bsp_model/src/lib/graphics/importer/texture.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/texture.cc	(revision 7521)
+++ /branches/bsp_model/src/lib/graphics/importer/texture.cc	(revision 7522)
@@ -34,4 +34,26 @@
 Texture::Texture(const std::string& imageName, GLenum target)
 {
+  this->init();
+
+  if (!imageName.empty())
+  {
+    this->setName(imageName);
+    this->loadImage(imageName, target);
+  }
+}
+
+Texture::Texture(SDL_Surface* surface, GLenum target)
+{
+  this->init();
+
+  if(surface != NULL)
+  {
+    this->loadSurface(surface, target);
+
+  }
+}
+
+void Texture::init()
+{
   this->setClassID(CL_TEXTURE, "Texture");
 
@@ -40,12 +62,5 @@
   this->image = NULL;
   this->priority = 0.5;
-
-  if (!imageName.empty())
-  {
-    this->setName(imageName);
-    this->loadImage(imageName, target);
-  }
-}
-
+}
 
 /**
@@ -64,5 +79,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
 */
@@ -71,33 +86,13 @@
   if (Texture::texturesEnabled)
   {
-    if (this->image != NULL)
-    {
-      SDL_FreeSurface(this->image);
-      this->image = NULL;
-    }
-    if (this->texture != 0)
-    {
-      glDeleteTextures(1, &this->texture);
-      this->texture = 0;
-    }
     if (!imageName.empty())
     {
       SDL_Surface* tmpSurf;
-      if (this->texture != 0 && glIsTexture(this->texture))
-        glDeleteTextures(1, &this->texture);
+
       // load the new Image to memory
       tmpSurf = IMG_Load(imageName.c_str());
       if(tmpSurf != NULL)
       {
-        PRINTF(4)("loading Image %s\n", imageName);
-        bool hasAlpha;
-        SDL_Surface* newSurf = this->prepareSurface(tmpSurf, hasAlpha);
-        if (newSurf != NULL)
-        {
-          this->setSurface(newSurf);
-          this->setAlpha(hasAlpha);
-          this->setTexture(Texture::loadTexToGL(newSurf, target));
-        }
-
+        this->loadSurface(tmpSurf, target);
         SDL_FreeSurface(tmpSurf);
         return true;
@@ -114,4 +109,38 @@
       PRINTF(2)("Image-Name not specified\n");
       return false;
+    }
+  }
+  return false;
+}
+
+/**
+ * @brief Loads an SDL_Surface.
+ */
+bool Texture::loadSurface(SDL_Surface* surface, GLenum target)
+{
+  if (Texture::texturesEnabled)
+  {
+    // some image was loaded before
+    if (this->image != NULL)
+    {
+      SDL_FreeSurface(this->image);
+      this->image = NULL;
+    }
+
+    // unload the old Texture.
+    if (this->texture != 0 && glIsTexture(this->texture))
+    {
+      glDeleteTextures(1, &this->texture);
+      this->texture = 0;
+    }
+
+    bool hasAlpha;
+    SDL_Surface* newSurf = this->prepareSurface(surface, hasAlpha);
+    if (newSurf != NULL)
+    {
+      this->setSurface(newSurf);
+      this->setAlpha(hasAlpha);
+      this->setTexture(Texture::loadTexToGL(newSurf, target));
+      return true;
     }
   }
Index: /branches/bsp_model/src/lib/graphics/importer/texture.h
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/texture.h	(revision 7521)
+++ /branches/bsp_model/src/lib/graphics/importer/texture.h	(revision 7522)
@@ -19,8 +19,9 @@
     public:
       Texture(const std::string& imageName = "", GLenum target = GL_TEXTURE_2D);
-  //  Texture(TEXTURE_TYPE type, int resolution);
+      Texture(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
       virtual ~Texture();
 
       bool loadImage(const std::string& imageName, GLenum target = GL_TEXTURE_2D);
+      bool loadSurface(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D);
       virtual bool rebuild();
 
@@ -28,5 +29,5 @@
       inline GLuint getTexture() const { return this->texture; };
       /** @returns true if texture has alpha, false otherwise */
-      inline bool hasAlpha() const {return bAlpha;}
+      inline bool hasAlpha() const  {return bAlpha; }
       /** @returns the stored image of this Texture */
       const SDL_Surface* const getStoredImage() const { return this->image; };
@@ -43,9 +44,10 @@
 
     protected:
-
       bool setSurface(SDL_Surface* newSurface);
       bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; };
       bool setTexture(GLuint texture) { this->texture = texture; };
 
+    private:
+      void init();
 
     private:
