Index: /orxonox/branches/parenting/src/campaign.cc
===================================================================
--- /orxonox/branches/parenting/src/campaign.cc	(revision 3337)
+++ /orxonox/branches/parenting/src/campaign.cc	(revision 3338)
@@ -89,8 +89,8 @@
   while( se != NULL && this->running)
     {
-      //se->displayLoadScreen();
+      se->displayLoadScreen();
       se->load();
       se->init();
-      //se->releaseLoadScreen();
+      se->releaseLoadScreen();
       se->start();
       se->destroy();
Index: /orxonox/branches/parenting/src/orxonox.cc
===================================================================
--- /orxonox/branches/parenting/src/orxonox.cc	(revision 3337)
+++ /orxonox/branches/parenting/src/orxonox.cc	(revision 3338)
@@ -115,9 +115,20 @@
   // Set video mode
   // TO DO: parse arguments for settings
-  SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
-  
+  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+  
+
+  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
+  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);    
+  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);  
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
+  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
+
+
+
   int bpp = 16;
   int width = 640;
@@ -138,5 +149,5 @@
   if( videoInfo->hw_available)
     videoFlags |= SDL_HWSURFACE;
-  else
+  else 
     videoFlags |= SDL_SWSURFACE;
   /*
@@ -153,5 +164,5 @@
   
   // Set window labeling
-  SDL_WM_SetCaption("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
+  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
   
   // TO DO: Create a cool icon and use it here
@@ -159,6 +170,6 @@
 
   // OpenGL stuff
-  glClearColor(0.0, 0.0, 0.0, 0.0);
-  glEnable(GL_DEPTH_TEST);
+  glClearColor (0.0, 0.0, 0.0, 0.0);
+  glEnable (GL_DEPTH_TEST);
  
   // LIGHTING
@@ -167,12 +178,13 @@
   GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
 
-  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
-  glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
-  glEnable(GL_LIGHTING);
-  glEnable(GL_LIGHT0);
-  glEnable(GL_DEPTH_TEST);
-  glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
+  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
+  glLightfv (GL_LIGHT0, GL_SPECULAR, whiteLight);
+  glEnable (GL_LIGHTING);
+  glEnable (GL_LIGHT0);
+  glEnable (GL_DEPTH_TEST);
+  glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
+  glLightfv (GL_LIGHT0, GL_DIFFUSE, whiteLight);
    
+  glEnable (GL_TEXTURE_2D); 
   //  glEnable(GL_COLOR);
   //  glShadeModel(GL_SMOOTH);
Index: /orxonox/branches/parenting/src/stdincl.h
===================================================================
--- /orxonox/branches/parenting/src/stdincl.h	(revision 3337)
+++ /orxonox/branches/parenting/src/stdincl.h	(revision 3338)
@@ -10,4 +10,6 @@
 
 #define null 0   //!< null
+
+typedef unsigned char byte;
 
 // this includes the information from configure/makefiles
Index: /orxonox/branches/parenting/src/world.cc
===================================================================
--- /orxonox/branches/parenting/src/world.cc	(revision 3337)
+++ /orxonox/branches/parenting/src/world.cc	(revision 3338)
@@ -145,43 +145,131 @@
 {
   printf ("World::displayLoadScreen - start\n"); 
-  SDL_Surface *screen;
-  SDL_RWops *rwop;
-  int i;
-  
-  //SDL_FreeSurface (Orxonox::getInstance()->getScreen ());
-  
-  /* load the image */
-  rwop = SDL_RWFromFile("load_screen.png", "rb");
-  this->loadImage = IMG_LoadPNG_RW (rwop);
-  if( !this->loadImage)
-    {
-      /* image failed to load */
-      printf ("IMG_Load: %s\n", IMG_GetError());
-    }
-  printf("loaded %s: %dx%d %dbpp\n", "load_screen.png",
-	 this->loadImage->w, this->loadImage->h, this->loadImage->format->BitsPerPixel);
-  
-
-  //  screen = SDL_SetVideoMode(this->loadImage->w, this->loadImage->h, this->loadImage->format->BitsPerPixel, SDL_ANYFORMAT);
-  screen = Orxonox::getInstance()->getScreen ();
-  if( !screen)
-    {
-      printf ("SDL_SetVideoMode: %s\n", SDL_GetError());
-      SDL_FreeSurface (this->loadImage);
+  
+  int w = 680;
+  int h = 480;
+
+  glViewport(0,0,w,h);
+  
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity(); 
+  gluPerspective(45.0f,(GLfloat)w/(GLfloat)h, .5f ,150.0f);
+  glMatrixMode(GL_MODELVIEW); 
+
+
+  SDL_Surface *pBitmap[1];
+  unsigned int textureArray[1];
+  char *strFileName = "orx_tex.bmp";
+  int textureID = 0;
+  
+  pBitmap[0] = SDL_LoadBMP (strFileName);
+  if( pBitmap[0] == NULL)
+    return;
+  
+  if(pBitmap[0] == NULL)                                // If we can't load the file, quit!
+    {
+      printf (" Failed loading %s\n", strFileName);
       SDL_Quit ();
-      return;
-    }
-  
-  /* print some info about the obtained screen */
-  printf("screen is %dx%d %dbpp\n", screen->w, screen->h, screen->format->BitsPerPixel);
-
-  /* do the initial image display */
-  SDL_BlitSurface (this->loadImage, 0, screen, 0);
-  
-  if (SDL_Flip (screen) != 0)
-    printf("World::displayLoadScreen - couldn't filp buffers");
-  
-  //image = IMG_Load ("load_screen.png"); 
-  printf ("World::displayLoadScreen - end\n");
+    }
+  glGenTextures(1, &textureArray[textureID]);
+  /* Bind the texture to the texture arrays index and init the texture */
+  glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
+  
+  /* Rearrange the pixelData since openGL has a different pixel orientation */
+  int width  = pBitmap[0]->w;
+  int height = pBitmap[0]->h;
+  unsigned char * data = (unsigned char *)(pBitmap[0]->pixels);
+  unsigned char * newData = new unsigned char[width * height * 3];
+  int channels = 3; /* RGB channel number*/
+  
+  int bytesPerPixel = pBitmap[0]->format->BytesPerPixel; 
+  
+  /* this is the real swapping algorithm */
+  for( int i = 0 ; i < (height / 2) ; ++i )
+    for( int j = 0 ; j < width * bytesPerPixel; j += bytesPerPixel )
+      for(int k = 0; k < bytesPerPixel; ++k)
+	swap( data[ (i * width * bytesPerPixel) + j + k], data[ ( (height - i - 1) * width * bytesPerPixel ) + j + k]);
+  
+  // the following lines extract R,G and B values from any bitmap
+  
+  for(int i = 0; i < (width * height); ++i)
+    {
+      byte r,g,b;
+      Uint32 pixel_value = 0;      
+      /* the following loop extracts the pixel (however wide it is 8,16,24 or 32) and 
+	 creates a long with all these bytes taken together.
+      */
+      
+      for(int j = bytesPerPixel - 1 ; j >= 0; --j)
+        {
+	  pixel_value = pixel_value << 8; 
+	  pixel_value = pixel_value | data[ (i * bytesPerPixel) + j ]; 
+        }                                                              
+      
+      SDL_GetRGB(pixel_value, pBitmap[0]->format, (Uint8 *)&r, (Uint8 *)&g, (Uint8 *)&b);
+      
+      newData[(i * channels) + 0] = r;
+      newData[(i * channels) + 1] = g;
+      newData[(i * channels) + 2] = b;
+   
+      pixel_value = 0;
+    }
+  
+  /* Build Mipmaps (builds different versions of the picture for distances - looks better) */
+  gluBuild2DMipmaps (GL_TEXTURE_2D, 3, pBitmap[0]->w, pBitmap[0]->h, GL_RGB, GL_UNSIGNED_BYTE, newData);
+  //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);    
+  glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+
+  delete [] newData;    
+  SDL_FreeSurface(pBitmap[0]);
+
+
+  /* ------------painten */
+
+  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+  glLoadIdentity();
+  gluLookAt(0, 0, 6,     0, 0, 0,     0, 1, 0);
+
+  // Bind the texture stored at the zero index of g_Texture[]
+  //glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
+  
+  // Display a quad texture to the screen
+  glBegin(GL_QUADS);
+  
+  // glTexCoord2f() takes the X and Y offset (or U and V) into the bitmap.
+  // Then, the next point sent to be rendered attaches that part of the bitmap
+  // to itself.  The (U, V) coordinates range from (0, 0) being the top left corner
+  // of the bitmap, to (1, 1) being the bottom left corner of the bitmap.
+  // You can go above 1 but it just is wrapped around back to zero and repeats the texture.
+  // Try setting the 1's to 2's and see what it does, then try setting them to 0.5's.
+  // The higher the number, the more instances of the texture will appear on the square,
+  // Where the lower the number, it stretches the incomplete texture over the surface of the square.
+  // For every vertice we need a U V coordinate, as shown below.  You might have to play
+  // around with the values to make it texture correctly, otherwise it will be flipped, upside down,
+  // or skewed.  It also depends on where you are looking at it.  We are looking down the -Z axis.
+  
+  // Display the top left vertice
+  glTexCoord2f(0.0f, 1.0f);
+  glVertex3f(-2.5, 2.5, 0);
+  
+  // Display the bottom left vertice
+  glTexCoord2f(0.0f, 0.0f);
+  glVertex3f(-2.5, -2.5, 0);
+  
+  // Display the bottom right vertice
+  glTexCoord2f(1.0f, 0.0f);
+  glVertex3f(2.5, -2.5, 0);
+  
+  // Display the top right vertice
+  glTexCoord2f(1.0f, 1.0f);
+  glVertex3f(2.5, 2.5, 0);
+
+  glEnd();
+  
+  SDL_GL_SwapBuffers();                    
+
+  glDisable (GL_TEXTURE_2D);
+  glDeleteTextures (1, &textureArray[textureID]);
+  SDL_Delay (5000);
+  printf ("World::displayLoadScreen - end\n"); 
 }
 
@@ -191,46 +279,4 @@
   printf ("World::releaseLoadScreen - start\n"); 
 
-  //if( SDL_Flip (Orxonox::getInstance()->getScreen ()) != 0)
-  //  printf("World::displayLoadScreen - culdn't filp buffers");
-
-  SDL_Delay (1000); 
-
-  SDL_FreeSurface (this->loadImage); 
-  SDL_FreeSurface (Orxonox::getInstance()->getScreen ());
-
-  SDL_Flip (Orxonox::getInstance()->getScreen ());
-
-  SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
-  SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
-
-  int bpp = 16;
-  int width = 640;
-  int height = 480;
-  Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
-  
-  SDL_Surface* screen = SDL_SetVideoMode (width, height, bpp, flags);
-
-  // OpenGL stuff
-  glClearColor(0.0, 0.0, 0.0, 0.0);
-  glEnable(GL_DEPTH_TEST);
- 
-  // LIGHTING
-  GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0};
-  GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0};
-  GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0};
-
-  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
-  glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight);
-  glEnable(GL_LIGHTING);
-  glEnable(GL_LIGHT0);
-  glEnable(GL_DEPTH_TEST);
-  glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-  glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);
-
-  //SDL_Surface* screen = Orxonox::getInstance()->getScreen ();
-
-  //SDL_Flip (screen);
 
 
@@ -825,5 +871,6 @@
       this->display ();
   
-      for( int i = 0; i < 10000000; i++) {}
+      for( int i = 0; i < 5000000; i++) {}
+      /* \todo this is to slow down the program for openGl Software emulator computers, reimplement*/
     }
   printf("World::mainLoop() - Exiting the main loop\n");
@@ -975,2 +1022,12 @@
 }
 
+
+
+
+void World::swap (unsigned char &a, unsigned char &b)
+{
+  unsigned char temp;
+  temp = a;
+  a    = b;
+  b    = temp;
+}
Index: /orxonox/branches/parenting/src/world.h
===================================================================
--- /orxonox/branches/parenting/src/world.h	(revision 3337)
+++ /orxonox/branches/parenting/src/world.h	(revision 3338)
@@ -93,4 +93,6 @@
   void display ();
   void debug ();
+
+  void swap (unsigned char &a, unsigned char &b); /* \todo: this function doesn't belong here, this should be part of a image class*/
 };
 
