Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 5261)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 5262)
@@ -31,8 +31,9 @@
 
 
+#include "shader.h"
+
 /**
  *  standard constructor
-   @todo this constructor is not jet implemented - do it
-*/
+ */
 GraphicsEngine::GraphicsEngine ()
 {
@@ -60,4 +61,8 @@
   this->hwVersion = NULL;
   this->hwExtensions = NULL;
+
+  Shader shader("test.txt");
+  shader.debug();
+  exit(-1);
 }
 
Index: trunk/src/lib/graphics/shader.cc
===================================================================
--- trunk/src/lib/graphics/shader.cc	(revision 5261)
+++ trunk/src/lib/graphics/shader.cc	(revision 5262)
@@ -18,4 +18,14 @@
 #include "shader.h"
 
+#include "array.h"
+#include "stdlibincl.h"
+#include <stdio.h>
+#include "debug.h"
+
+
+#ifndef PARSELINELENGHT
+#define PARSELINELENGHT     512       //!< how many chars to read at once
+#endif
+
 using namespace std;
 
@@ -24,5 +34,5 @@
  * standard constructor
 */
-Shader::Shader (SHADER_TYPE type, ...)
+Shader::Shader (const char* vertexShaderFile, const char* fragmentShaderFile)
 {
    this->setClassID(CL_SHADER, "Shader");
@@ -35,4 +45,9 @@
    this->vertexShader = 0;
    this->fragmentShader = 0;
+
+   if (vertexShaderFile != NULL)
+     this->loadShaderProgramm(SHADER_VERTEX, vertexShaderFile);
+   if (fragmentShaderFile != NULL)
+     this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile);
 }
 
@@ -44,9 +59,6 @@
 {
   // delete what has to be deleted here
-  delete[] this->fragmentShaderFile;
-  delete[] this->vertexShaderFile;
-  delete[] this->fragmentShaderSource;
-  delete[] this->vertexShaderSource;
-
+  this->deleteProgram(SHADER_VERTEX);
+  this->deleteProgram(SHADER_FRAGMENT);
   // DELETE THE PROGRAMS
 /*  this->shaderProgram = 0;
@@ -58,8 +70,57 @@
 bool Shader::loadShaderProgramm(SHADER_TYPE type, const char* fileName)
 {
-  if (type != SHADER_VERTEX || type != SHADER_FRAGMENT)
+  if (type != SHADER_VERTEX && type != SHADER_FRAGMENT)
     return false;
+  this->deleteProgram(type);
+
+  FILE*    stream;           //< The stream we use to read the file.
+
+  if( (stream = fopen (fileName, "r")) == NULL)
+  {
+    PRINTF(1)("Shader could not open %s\n", fileName);
+    return false;
+  }
+  Array<char*>* program = new Array<char*>;
+  if (type == SHADER_VERTEX)
+  {
+    this->vertexShaderFile = new char[strlen(fileName)+1];
+    strcpy(this->vertexShaderFile, fileName);
+    this->vertexShaderSource = program;
+  }
+  else
+  {
+    this->fragmentShaderFile = new char[strlen(fileName)+1];
+    strcpy(this->fragmentShaderFile, fileName);
+    this->fragmentShaderSource = program;
+  }
+
+  char lineBuffer[PARSELINELENGHT];
+  char* addString;
+  while( !feof( stream))
+  {
+      // get next line
+    fgets (lineBuffer, PARSELINELENGHT, stream);
+    if (strchr(lineBuffer, '\n'))
+    {
+      addString = new char[strlen(lineBuffer)];
+      strncpy(addString, lineBuffer, strlen (lineBuffer)-1);
+      addString[strlen(lineBuffer)-1] ='\0';
+    }
+    else
+    {
+      addString = new char[strlen(lineBuffer)+1];
+      strcpy(addString, lineBuffer);
+    }
+    program->addEntry(addString);
+
+    printf(lineBuffer);
+  }
+  fclose(stream);
+
+  program->finalizeArray();
 
 
+//  this->shaderProgram = glCreateProgramObjectARB();
+  this->vertexShader =1;
 }
 
@@ -68,2 +129,58 @@
 
 }
+
+
+void Shader::deleteProgram(SHADER_TYPE type)
+{
+  Array<char*>* deleteArray = NULL;
+  if (type == SHADER_VERTEX)
+  {
+    deleteArray = this->vertexShaderSource;
+    this->vertexShaderSource = NULL;
+    delete[] this->vertexShaderFile;
+    this->vertexShaderFile = NULL;
+  }
+  else if (type == SHADER_FRAGMENT)
+  {
+    deleteArray = this->fragmentShaderSource;
+    this->fragmentShaderSource = NULL;
+    delete[] this->fragmentShaderFile;
+    this->fragmentShaderFile = NULL;
+  }
+  else
+    return;
+
+  if (deleteArray == NULL)
+    return;
+  else
+  {
+    deleteArray->finalizeArray();
+    for (unsigned int i = 0; i < deleteArray->getCount(); i++)
+    {
+      delete[] deleteArray->getEntry(i);
+    }
+    delete deleteArray;
+  }
+}
+
+void Shader::debug() const
+{
+  PRINT(3)("Shader info: (SHADER: %d)\n", this->shaderProgram);
+  if (this->vertexShader != 0)
+  {
+    PRINT(3)("VertexShaderProgramm: number=%d, file='%s'\n", this->vertexShader, this->vertexShaderFile);
+    if (this->vertexShaderSource != NULL)
+      for (unsigned int i = 0; i < this->vertexShaderSource->getCount(); i++)
+        PRINT(3)("%d: %s\n", i, this->vertexShaderSource->getEntry(i));
+  }
+  if (this->fragmentShader != 0)
+  {
+    PRINT(3)("FragmentShaderProgramm: number=%d, file='%s'\n", this->fragmentShader, this->fragmentShaderFile);
+    if (this->fragmentShaderSource != NULL)
+      for (unsigned int i = 0; i < this->fragmentShaderSource->getCount(); i++)
+        PRINT(3)("%d: %s\n", i, this->fragmentShaderSource->getEntry(i));
+  }
+
+
+}
+
Index: trunk/src/lib/graphics/shader.h
===================================================================
--- trunk/src/lib/graphics/shader.h	(revision 5261)
+++ trunk/src/lib/graphics/shader.h	(revision 5262)
@@ -20,5 +20,5 @@
 
 // FORWARD DECLARATION
-
+template<class T> class Array;
 
 
@@ -27,15 +27,20 @@
 
  public:
-  Shader(SHADER_TYPE type, ...);
+  Shader(const char* vertexShaderFile = NULL, const char* fragmentShaderFile = NULL);
   virtual ~Shader();
 
   bool loadShaderProgramm(SHADER_TYPE type, const char* fileName);
   bool activateShader();
+  void deleteProgram(SHADER_TYPE type);
+
+  void debug() const;
+
+  private:
 
  private:
    char*                  fragmentShaderFile;
    char*                  vertexShaderFile;
-   char*                  fragmentShaderSource;
-   char*                  vertexShaderSource;
+   Array<char*>*          fragmentShaderSource;
+   Array<char*>*          vertexShaderSource;
    GLenum                 shaderProgram;
    GLenum                 vertexShader;
