Index: /trunk/configure
===================================================================
--- /trunk/configure	(revision 5272)
+++ /trunk/configure	(revision 5273)
@@ -5446,70 +5446,9 @@
 echo "${ECHO_T}$ac_cv_lib_glew32_main" >&6
 if test $ac_cv_lib_glew32_main = yes; then
-  echo "$as_me:$LINENO: checking for main in -lglew32s" >&5
-echo $ECHO_N "checking for main in -lglew32s... $ECHO_C" >&6
-if test "${ac_cv_lib_glew32s_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lglew32s  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_glew32s_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_glew32s_main=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_glew32s_main" >&5
-echo "${ECHO_T}$ac_cv_lib_glew32s_main" >&6
-if test $ac_cv_lib_glew32s_main = yes; then
   FOUND_glew32=yes
 fi
 
-fi
-
     if test x$FOUND_glew32 = xyes ; then
-        LIBS="$LIBS -lglew32 -lglew32s"
+        LIBS="$LIBS -lglew32"
     else
          echo "------------------"
Index: /trunk/src/lib/graphics/shader.cc
===================================================================
--- /trunk/src/lib/graphics/shader.cc	(revision 5272)
+++ /trunk/src/lib/graphics/shader.cc	(revision 5273)
@@ -19,4 +19,5 @@
 
 #include "stdlibincl.h"
+#include "compiler.h"
 #include <stdio.h>
 #include "debug.h"
@@ -44,14 +45,20 @@
 
    if (GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100)
-     this->shaderProgram = glCreateProgramObjectARB();
-
-   if (vertexShaderFile != NULL)
-     this->loadShaderProgramm(SHADER_VERTEX, vertexShaderFile);
-   if (fragmentShaderFile != NULL)
-     this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile);
-  try  {
-   glLinkProgramARB(this->shaderProgram); }
-  catch(GLenum errorCode)  {
-   this->printError(this->shaderProgram); }
+     {
+       this->shaderProgram = glCreateProgramObjectARB();
+
+       if (vertexShaderFile != NULL)
+	 this->loadShaderProgramm(SHADER_VERTEX, vertexShaderFile);
+       if (fragmentShaderFile != NULL)
+	 this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile);
+       try  {
+	 glLinkProgramARB(this->shaderProgram); }
+       catch(GLenum errorCode)  {
+	 this->printError(this->shaderProgram); }
+     }
+   else
+     {
+       PRINTF(2)("Shaders are not supported on your hardware\n");
+     }
 }
 
@@ -66,7 +73,10 @@
   this->deleteProgram(SHADER_FRAGMENT);
 
-  glDeleteObjectARB(this->fragmentShader);
-  glDeleteObjectARB(this->vertexShader);
-  glDeleteObjectARB(this->shaderProgram);
+  if (this->fragmentShader != 0)
+    glDeleteObjectARB(this->fragmentShader);
+  if (this->vertexShader != 0)
+    glDeleteObjectARB(this->vertexShader);
+  if (this->shaderProgram != 0)
+    glDeleteObjectARB(this->shaderProgram);
 }
 
@@ -98,16 +108,19 @@
     shader = this->fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
   }
-  glShaderSourceARB(shader, 1, (const GLcharARB**)&program, NULL);
-  try {
-    glCompileShaderARB(shader);
-  }
-  catch (...)
-  {
-    this->printError(shader);
-  }
-  glAttachObjectARB(this->shaderProgram, shader);
-  delete[] program;
-}
-
+
+  if (shader != 0)
+    {
+      glShaderSourceARB(shader, 1, (const GLcharARB**)&program, NULL);
+      try {
+	glCompileShaderARB(shader);
+      }
+      catch (...)
+	{
+	  this->printError(shader);
+	}
+      glAttachObjectARB(this->shaderProgram, shader);
+      delete[] program;
+    }
+}
 
 char* Shader::fileRead(const char* fileName)
@@ -139,5 +152,6 @@
 void Shader::activateShader()
 {
-  glUseProgramObjectARB(this->shaderProgram);
+  if (likely (this->shaderProgram != 0))
+    glUseProgramObjectARB(this->shaderProgram);
 }
 
@@ -150,5 +164,5 @@
 void Shader::deleteProgram(SHADER_TYPE type)
 {
-  if (type == SHADER_VERTEX)
+  if (type == SHADER_VERTEX && this->vertexShader != 0)
   {
     delete[] this->vertexShaderFile;
@@ -157,5 +171,5 @@
     this->vertexShader = 0;
   }
-  else if (type == SHADER_FRAGMENT)
+  else if (type == SHADER_FRAGMENT && this->fragmentShader != 0)
   {
     delete[] this->fragmentShaderFile;
@@ -171,4 +185,7 @@
 void Shader::printError(GLenum program)
 {
+  if (program == 0)
+    return;
+
   int infologLength = 0;
   int charsWritten  = 0;
@@ -206,6 +223,4 @@
         PRINT(3)("%d: %s\n", i, this->fragmentShaderSource->getEntry(i));*/
   }
-
-
-}
-
+}
+
