Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 5861)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 5863)
@@ -45,4 +45,5 @@
 }
 
+
 /**
  *  Destructor of a Texture
@@ -57,4 +58,5 @@
     SDL_FreeSurface(this->image);
 }
+
 
 /**
@@ -114,4 +116,9 @@
 }
 
+
+/**
+ * rebuilds the texture.
+ * reloads the Texture from Memory to OpenGL.
+ */
 bool Texture::rebuild()
 {
@@ -128,7 +135,40 @@
       this->setTexture(loadTexToGL(this->image));
     }
-
-}
-
+}
+
+
+/**
+ * set the surface this Texture handles
+ * @param newSurface the new Surface to set as the image for this Texture.
+ *
+ * This deletes the old version of the stored Texture,
+ * and sets the newly given Surface as current.
+ */
+bool Texture::setSurface(SDL_Surface* newSurface)
+{
+  if (this->image != NULL)
+    SDL_FreeSurface(this->image);
+
+  this->image = newSurface;
+
+  return (this->image != NULL);
+}
+
+
+bool Texture::texturesEnabled = true;
+
+/**
+ * enables, disables textures
+ * @param texturesEnabled true if the textures should be enabled
+ */
+void Texture::setTextureEnableState(bool texturesEnabled)
+{
+  Texture::texturesEnabled = texturesEnabled;
+}
+
+
+//////////////////////////////////////
+// UTILITY FUNCTIONALITY OF TEXTURE //
+//////////////////////////////////////
 /**
  * converts surface to a new SDL_Surface, that is loadable by openGL
@@ -148,6 +188,6 @@
   hasAlpha = false;
   retSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
-                               surface->w, surface->h,
-                               32,
+                                    surface->w, surface->h,
+                                    32,
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
                                0x000000FF,
@@ -156,10 +196,10 @@
                                0xFF000000
 #else
-                               0xFF000000,
+                                   0xFF000000,
                                0x00FF0000,
                                0x0000FF00,
                                0x000000FF
 #endif
-                               );
+                                   );
   if ( retSurface == NULL )
   {
@@ -191,37 +231,5 @@
 }
 
-/**
- * set the surface this Texture handles
- * @param newSurface the new Surface to set as the image for this Texture.
- *
- * This deletes the old version of the stored Texture,
- * and sets the newly given Surface as current.
- */
-bool Texture::setSurface(SDL_Surface* newSurface)
-{
-  if (this->image != NULL)
-    SDL_FreeSurface(this->image);
-
-  this->image = newSurface;
-
-  return (this->image != NULL);
-}
-
-
-bool Texture::texturesEnabled = true;
-
-/**
- * enables, disables textures
- * @param texturesEnabled true if the textures should be enabled
- */
-void Texture::setTextureEnableState(bool texturesEnabled)
-{
-  Texture::texturesEnabled = texturesEnabled;
-}
-
-
-//////////////////////////////////////
-// UTILITY FUNCTIONALITY OF TEXTURE //
-//////////////////////////////////////
+
 /**
  *  Loads a Texture to the openGL-environment.
Index: trunk/src/lib/graphics/importer/texture_sequence.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture_sequence.cc	(revision 5861)
+++ trunk/src/lib/graphics/importer/texture_sequence.cc	(revision 5863)
@@ -20,6 +20,4 @@
 #include "debug.h"
 #include "graphics_engine.h"
-
-#include <stdarg.h>
 
 #ifdef HAVE_SDL_IMAGE_H
@@ -49,4 +47,18 @@
 TextureSequence::~TextureSequence()
 {
+  // delete all images
+  while(!this->images.empty())
+  {
+    SDL_FreeSurface(this->images.back());
+    this->images.pop_back();
+  }
+
+  // delete all textures.
+  while(!this->textures.empty())
+  {
+    if (glIsTexture(this->textures.back()))
+      glDeleteTextures(1, &this->textures.back());
+    this->textures.pop_back();
+  }
 }
 
@@ -57,20 +69,25 @@
 bool TextureSequence::rebuild()
 {
-//   if (this->texture != 0 && glIsTextureSequence(this->texture))
-//     {
-//       glDeleteTextureSequences(1,&this->texture);
-//       this->texture = 0;
-//     }
-//
-//   if (this->image != NULL)
-//     {
-//       PRINTF(3)("Reloading TextureSequence of %s '%s'\n", this->getClassName(), this->getName());
-//       this->texture = loadTexToGL(this->image);
-//     }
+  PRINTF(3)("Reloading TextureSequence of %s '%s'\n", this->getClassName(), this->getName());
 
+  for (unsigned int i = 0; i < this->textures.size(); i++)
+  {
+    if (glIsTexture(this->textures[i]))
+    {
+      glDeleteTextures(1, &this->textures[i]);
+      this->textures[i] = 0;
+    }
+
+    if (this->images[i] != NULL)
+      this->textures[i] = loadTexToGL(this->images[i]);
+  }
 }
 
-
-
+/**
+ * loads an image Series
+ * @param count how many images to load to the TextureSequence
+ * @param ... the names of the Images to load
+ * @returns true on success, false otherwise
+ */
 bool TextureSequence::loadImageSeries(unsigned int count, ...)
 {
@@ -78,11 +95,22 @@
   va_start(textureNameList, count);
 
-  this->loadImageSeries(count, textureNameList);
+  return this->loadImageSeries(count, textureNameList);
 }
 
+/**
+ * loads an image Series
+ * @param count how many images to load to the TextureSequence
+ * @param textures the names of the Images to load
+ * @returns true on success, false otherwise
+ */
 bool TextureSequence::loadImageSeries(unsigned int count, va_list textures)
 {
-
-
+  bool retVal = true;
+  for (unsigned int i = 0; i < count; i++)
+  {
+    if( !this->addFrame(va_arg(textures, char*)))
+      retVal = false;
+  }
+  return retVal;
 }
 
@@ -90,14 +118,29 @@
 bool TextureSequence::addFrame(const char* imageName)
 {
+  if (imageName == NULL)
+    return false;
 
+  SDL_Surface* addSurface = IMG_Load(imageName);
+  bool success = this->addFrame(addSurface);
+  delete addSurface;
 
+  return success;
 }
 
-
+/**
+ * adds a new Frame at the end of the Sequence.
+ * @param surface the Surface to add at the end of the Sequence.
+ */
 bool TextureSequence::addFrame(SDL_Surface* surface)
 {
-
-
+  if (surface == NULL)
+    return false;
+  bool hasAlpha;
+  SDL_Surface* newSurf = this->prepareSurface(surface, hasAlpha);
+  if (newSurf != NULL)
+  {
+    this->images.push_back(newSurf);
+    this->textures.push_back(Texture::loadTexToGL(newSurf));
+  }
+  this->setAlpha(hasAlpha);
 }
-
-
