Index: /orxonox/branches/dave/src/orxonox.cc
===================================================================
--- /orxonox/branches/dave/src/orxonox.cc	(revision 3678)
+++ /orxonox/branches/dave/src/orxonox.cc	(revision 3679)
@@ -132,6 +132,6 @@
 
   int bpp = 16;
-  int width = 400;
-  int height = 300;
+  int width = 1024;
+  int height = 768;
   //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
   //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
@@ -177,5 +177,5 @@
   GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0};
   GLfloat brightLight[]={2.0,2.0,2.0,1.0};
-  GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
+  GLfloat lightPosition[] = {0.0, 4, 4, 0.0};
   GLfloat lightPosition2[]={ 180.0,-20.0,-30.0,0.0};
 
Index: /orxonox/branches/dave/src/shadow.cc
===================================================================
--- /orxonox/branches/dave/src/shadow.cc	(revision 3678)
+++ /orxonox/branches/dave/src/shadow.cc	(revision 3679)
@@ -39,6 +39,7 @@
 */
 
-Shadow::Shadow()
-{
+Shadow::Shadow(Model* player,float* groundVertexes)
+{
+    this->player=player;
 }
 
@@ -51,4 +52,123 @@
 {
 }
+
+void Shadow::init()
+{
+    
+    float plane_s[] ={1.0f,0.0f,0.0f,0.0f};
+    float plane_t[] ={0.0f,1.0f,0.0f,0.0f};
+    float plane_r[] ={0.0f,0.0f,1.0f,0.0f};
+    float plane_q[] ={0.0f,0.0f,0.0f,1.0f};
+    
+    glClearDepth(1);
+    glDepthFunc(GL_LEQUAL);
+    glTexGenfv(GL_S,GL_EYE_PLANE,plane_s);
+    glTexGenfv(GL_T,GL_EYE_PLANE,plane_t);
+    glTexGenfv(GL_R,GL_EYE_PLANE,plane_r);
+    glTexGenfv(GL_Q,GL_EYE_PLANE,plane_q);
+    glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_EYE_LINEAR);
+    glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_EYE_LINEAR);
+    glTexGeni(GL_R,GL_TEXTURE_GEN_MODE,GL_EYE_LINEAR);
+    glTexGeni(GL_Q,GL_TEXTURE_GEN_MODE,GL_EYE_LINEAR);
+    
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE_EXT);
+    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE_EXT);
+    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,SIZE,SIZE,0,GL_RGB,GL_UNSIGNED_BYTE,NULL);
+
+    this->ground_id=glGenLists(1);
+    glNewList(this->ground_id,GL_COMPILE);
+    
+    //blabla
+    
+    glEndList();
+    
+    this->player_id=glGenLists(1);
+    glNewList(this->player_id,GL_COMPILE);
+    
+    //blabla
+    
+    glEndList();    
+    
+    this->image=(unsigned char*)malloc(SIZE*SIZE*4);
+    
+    //this->player_id=newList {glNormalefv;glVertex3fv}
+    //this->ground_id=newList {glTexCoord2fv;glNormal3fv;glVertex3fv}
+    
+    
+    //lightPos[] blabla
+}
+
+
+void Shadow::createShadow()
+{
+    glViewport(0,0,SIZE,SIZE);
+    glScissor(0,0,SIZE,SIZE);
+    glEnable(GL_SCISSOR_TEST);
+    glBindTexture(GL_TEXTURE_2D,this->shadow_id);
+    
+    glClearColor(1,1,1,1);
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    glOrtho(-1,1,-1,1,-100,100);
+    glMatrixMode(GL_MODELVIEW);
+    glLoadIdentity();
+    
+    //gluLookAt(light0,light1,light2,player0,player1,player2,0,0,1);
+    
+    glColor3f(.4,.4,.4);
+    //glTranslatef(player0,player1,player2);
+    glCallList(this->player_id);
+    glColor3f(1,1,1);
+    glReadPixels(0,0,SIZE,SIZE,GL_RGB,GL_UNSIGNED_BYTE,this->image);
+    blur(this->image,SIZE);
+    glTexSubImage2D(GL_TEXTURE_2D,0,0,0,SIZE,SIZE,GL_RGB,GL_UNSIGNED_BYTE,this->image);
+    
+    glDisable(GL_SCISSOR_TEST);
+    glViewport(0,0,1024,768); //Achtung: hier Aufloesung von Orxonox einstellen!
+     
+    
+    
+}
+
+void Shadow::m_inverse(const float *m,float *out)
+{
+    float det;
+    det=m[0]*m[5]*m[10];
+    det+= m[4]*m[9]*m[2];
+    det+= m[8]*m[1]*m[6];
+    det-= m[8]*m[5]*m[2];
+    det-= m[4]*m[1]*m[10];
+    det-= m[0]*m[9]*[6];
+    
+    
+}
+
+
+void Shadow::draw()
+{
+    float m[16],im[16];
+    createShadow();
+    
+    glClearColor(0,0,0,0);
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    gluPerspective(45,4.0/3.0,.5,100);
+    glMatrixMode(GL_MODELVIEW);
+    glLoadIdentity();
+    
+    //gluLookAt(camera0,camera1,camera2,player0,player1,player2,0,0,1);
+    
+    glEnable(GL_TEXTURE_GEN_S);
+    glEnable(GL_TEXTURE_GEN_T);
+    glEnable(GL_TEXTURE_GEN_R);
+    glEnable(GL_TEXTURE_GEN_Q);
+    glGetFloatv(GL_MODELVIEW_MATRIX,m);
+    
+}
+
 
 
Index: /orxonox/branches/dave/src/shadow.h
===================================================================
--- /orxonox/branches/dave/src/shadow.h	(revision 3678)
+++ /orxonox/branches/dave/src/shadow.h	(revision 3679)
@@ -19,4 +19,5 @@
 
 #include "importer/material.h"
+#include "importer/model.h"
 #include "p_node.h"
 #include "world_entity.h"
@@ -26,8 +27,21 @@
 {
     private:
+	int player_id,ground_id; //These are for the glLists!
+	int shadow_id;  //this is for the empty shadow texture
+	int lightPos[3];
+	
+	unsigned char *image;
+	Model* player;
+	
 	void blur(unsigned char *in,int size);
+	void createShadow();
+	void m_inverse(const float *m,float *out);
+	
+    
     public:
-	Shadow();
+	Shadow(Model* player,float* groundVertexes);
 	~Shadow();
+	void init();
+	void draw();
 
 
