Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5271 in orxonox.OLD


Ignore:
Timestamp:
Sep 28, 2005, 6:04:59 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better checking, and not loading shader if it is non-existent

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r5265 r5271  
    52275227         echo "GLU library not found."
    52285228         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
     5229         echo "------------------"
     5230         exit -1
     5231    fi
     5232
     5233# checking glew header
     5234
     5235for ac_header in GL/glew.h
     5236do
     5237as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
     5238if eval "test \"\${$as_ac_Header+set}\" = set"; then
     5239  echo "$as_me:$LINENO: checking for $ac_header" >&5
     5240echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
     5241if eval "test \"\${$as_ac_Header+set}\" = set"; then
     5242  echo $ECHO_N "(cached) $ECHO_C" >&6
     5243fi
     5244echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
     5245echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
     5246else
     5247  # Is the header compilable?
     5248echo "$as_me:$LINENO: checking $ac_header usability" >&5
     5249echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
     5250cat >conftest.$ac_ext <<_ACEOF
     5251/* confdefs.h.  */
     5252_ACEOF
     5253cat confdefs.h >>conftest.$ac_ext
     5254cat >>conftest.$ac_ext <<_ACEOF
     5255/* end confdefs.h.  */
     5256$ac_includes_default
     5257#include <$ac_header>
     5258_ACEOF
     5259rm -f conftest.$ac_objext
     5260if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
     5261  (eval $ac_compile) 2>conftest.er1
     5262  ac_status=$?
     5263  grep -v '^ *+' conftest.er1 >conftest.err
     5264  rm -f conftest.er1
     5265  cat conftest.err >&5
     5266  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5267  (exit $ac_status); } &&
     5268         { ac_try='test -z "$ac_c_werror_flag"
     5269                         || test ! -s conftest.err'
     5270  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5271  (eval $ac_try) 2>&5
     5272  ac_status=$?
     5273  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5274  (exit $ac_status); }; } &&
     5275         { ac_try='test -s conftest.$ac_objext'
     5276  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5277  (eval $ac_try) 2>&5
     5278  ac_status=$?
     5279  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5280  (exit $ac_status); }; }; then
     5281  ac_header_compiler=yes
     5282else
     5283  echo "$as_me: failed program was:" >&5
     5284sed 's/^/| /' conftest.$ac_ext >&5
     5285
     5286ac_header_compiler=no
     5287fi
     5288rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
     5289echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
     5290echo "${ECHO_T}$ac_header_compiler" >&6
     5291
     5292# Is the header present?
     5293echo "$as_me:$LINENO: checking $ac_header presence" >&5
     5294echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
     5295cat >conftest.$ac_ext <<_ACEOF
     5296/* confdefs.h.  */
     5297_ACEOF
     5298cat confdefs.h >>conftest.$ac_ext
     5299cat >>conftest.$ac_ext <<_ACEOF
     5300/* end confdefs.h.  */
     5301#include <$ac_header>
     5302_ACEOF
     5303if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
     5304  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
     5305  ac_status=$?
     5306  grep -v '^ *+' conftest.er1 >conftest.err
     5307  rm -f conftest.er1
     5308  cat conftest.err >&5
     5309  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5310  (exit $ac_status); } >/dev/null; then
     5311  if test -s conftest.err; then
     5312    ac_cpp_err=$ac_c_preproc_warn_flag
     5313    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
     5314  else
     5315    ac_cpp_err=
     5316  fi
     5317else
     5318  ac_cpp_err=yes
     5319fi
     5320if test -z "$ac_cpp_err"; then
     5321  ac_header_preproc=yes
     5322else
     5323  echo "$as_me: failed program was:" >&5
     5324sed 's/^/| /' conftest.$ac_ext >&5
     5325
     5326  ac_header_preproc=no
     5327fi
     5328rm -f conftest.err conftest.$ac_ext
     5329echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
     5330echo "${ECHO_T}$ac_header_preproc" >&6
     5331
     5332# So?  What about this header?
     5333case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
     5334  yes:no: )
     5335    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
     5336echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
     5337    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
     5338echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
     5339    ac_header_preproc=yes
     5340    ;;
     5341  no:yes:* )
     5342    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
     5343echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
     5344    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
     5345echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
     5346    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
     5347echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
     5348    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
     5349echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     5350    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
     5351echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     5352    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
     5353echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     5354    (
     5355      cat <<\_ASBOX
     5356## ---------------------------------------------- ##
     5357## Report this to orxonox-dev at mail.datacore.ch ##
     5358## ---------------------------------------------- ##
     5359_ASBOX
     5360    ) |
     5361      sed "s/^/$as_me: WARNING:     /" >&2
     5362    ;;
     5363esac
     5364echo "$as_me:$LINENO: checking for $ac_header" >&5
     5365echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
     5366if eval "test \"\${$as_ac_Header+set}\" = set"; then
     5367  echo $ECHO_N "(cached) $ECHO_C" >&6
     5368else
     5369  eval "$as_ac_Header=\$ac_header_preproc"
     5370fi
     5371echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
     5372echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
     5373
     5374fi
     5375if test `eval echo '${'$as_ac_Header'}'` = yes; then
     5376  cat >>confdefs.h <<_ACEOF
     5377#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
     5378_ACEOF
     5379
     5380else
     5381  { { echo "$as_me:$LINENO: error: cannot find opengl extension wrangler headers" >&5
     5382echo "$as_me: error: cannot find opengl extension wrangler headers" >&2;}
     5383   { (exit 1); exit 1; }; }
     5384fi
     5385
     5386done
     5387
     5388#   checking for Windows glew library
     5389    echo "$as_me:$LINENO: checking for main in -lglew32" >&5
     5390echo $ECHO_N "checking for main in -lglew32... $ECHO_C" >&6
     5391if test "${ac_cv_lib_glew32_main+set}" = set; then
     5392  echo $ECHO_N "(cached) $ECHO_C" >&6
     5393else
     5394  ac_check_lib_save_LIBS=$LIBS
     5395LIBS="-lglew32  $LIBS"
     5396cat >conftest.$ac_ext <<_ACEOF
     5397/* confdefs.h.  */
     5398_ACEOF
     5399cat confdefs.h >>conftest.$ac_ext
     5400cat >>conftest.$ac_ext <<_ACEOF
     5401/* end confdefs.h.  */
     5402
     5403
     5404int
     5405main ()
     5406{
     5407main ();
     5408  ;
     5409  return 0;
     5410}
     5411_ACEOF
     5412rm -f conftest.$ac_objext conftest$ac_exeext
     5413if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
     5414  (eval $ac_link) 2>conftest.er1
     5415  ac_status=$?
     5416  grep -v '^ *+' conftest.er1 >conftest.err
     5417  rm -f conftest.er1
     5418  cat conftest.err >&5
     5419  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5420  (exit $ac_status); } &&
     5421         { ac_try='test -z "$ac_c_werror_flag"
     5422                         || test ! -s conftest.err'
     5423  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5424  (eval $ac_try) 2>&5
     5425  ac_status=$?
     5426  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5427  (exit $ac_status); }; } &&
     5428         { ac_try='test -s conftest$ac_exeext'
     5429  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5430  (eval $ac_try) 2>&5
     5431  ac_status=$?
     5432  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5433  (exit $ac_status); }; }; then
     5434  ac_cv_lib_glew32_main=yes
     5435else
     5436  echo "$as_me: failed program was:" >&5
     5437sed 's/^/| /' conftest.$ac_ext >&5
     5438
     5439ac_cv_lib_glew32_main=no
     5440fi
     5441rm -f conftest.err conftest.$ac_objext \
     5442      conftest$ac_exeext conftest.$ac_ext
     5443LIBS=$ac_check_lib_save_LIBS
     5444fi
     5445echo "$as_me:$LINENO: result: $ac_cv_lib_glew32_main" >&5
     5446echo "${ECHO_T}$ac_cv_lib_glew32_main" >&6
     5447if test $ac_cv_lib_glew32_main = yes; then
     5448  echo "$as_me:$LINENO: checking for main in -lglew32s" >&5
     5449echo $ECHO_N "checking for main in -lglew32s... $ECHO_C" >&6
     5450if test "${ac_cv_lib_glew32s_main+set}" = set; then
     5451  echo $ECHO_N "(cached) $ECHO_C" >&6
     5452else
     5453  ac_check_lib_save_LIBS=$LIBS
     5454LIBS="-lglew32s  $LIBS"
     5455cat >conftest.$ac_ext <<_ACEOF
     5456/* confdefs.h.  */
     5457_ACEOF
     5458cat confdefs.h >>conftest.$ac_ext
     5459cat >>conftest.$ac_ext <<_ACEOF
     5460/* end confdefs.h.  */
     5461
     5462
     5463int
     5464main ()
     5465{
     5466main ();
     5467  ;
     5468  return 0;
     5469}
     5470_ACEOF
     5471rm -f conftest.$ac_objext conftest$ac_exeext
     5472if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
     5473  (eval $ac_link) 2>conftest.er1
     5474  ac_status=$?
     5475  grep -v '^ *+' conftest.er1 >conftest.err
     5476  rm -f conftest.er1
     5477  cat conftest.err >&5
     5478  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5479  (exit $ac_status); } &&
     5480         { ac_try='test -z "$ac_c_werror_flag"
     5481                         || test ! -s conftest.err'
     5482  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5483  (eval $ac_try) 2>&5
     5484  ac_status=$?
     5485  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5486  (exit $ac_status); }; } &&
     5487         { ac_try='test -s conftest$ac_exeext'
     5488  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5489  (eval $ac_try) 2>&5
     5490  ac_status=$?
     5491  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5492  (exit $ac_status); }; }; then
     5493  ac_cv_lib_glew32s_main=yes
     5494else
     5495  echo "$as_me: failed program was:" >&5
     5496sed 's/^/| /' conftest.$ac_ext >&5
     5497
     5498ac_cv_lib_glew32s_main=no
     5499fi
     5500rm -f conftest.err conftest.$ac_objext \
     5501      conftest$ac_exeext conftest.$ac_ext
     5502LIBS=$ac_check_lib_save_LIBS
     5503fi
     5504echo "$as_me:$LINENO: result: $ac_cv_lib_glew32s_main" >&5
     5505echo "${ECHO_T}$ac_cv_lib_glew32s_main" >&6
     5506if test $ac_cv_lib_glew32s_main = yes; then
     5507  FOUND_glew32=yes
     5508fi
     5509
     5510fi
     5511
     5512    if test x$FOUND_glew32 = xyes ; then
     5513        LIBS="$LIBS -lglew32 -lglew32s"
     5514    else
     5515         echo "------------------"
     5516         echo "opengl extension wrangler not found."
     5517         echo "please install the glew package which can be found at http://glew.sourceforge.net"
    52295518         echo "------------------"
    52305519         exit -1
  • trunk/src/lib/graphics/shader.cc

    r5269 r5271  
    8080
    8181  const char* program = fileRead(fileName);
     82  if (program == NULL)
     83    return false;
    8284  GLenum shader = 0;
    8385  if (type == SHADER_VERTEX && GLEW_ARB_vertex_shader)
     
    116118  int count = 0;
    117119
    118   if (fileName != NULL) {
    119     fileHandle = fopen(fileName, "rt");
    120 
    121     if (fileHandle != NULL) {
    122 
    123       fseek(fileHandle, 0, SEEK_END);
    124       count = ftell(fileHandle);
    125       rewind(fileHandle);
    126 
    127       if (count > 0) {
    128         content = new char[count+1];
    129         count = fread(content, sizeof(char), count, fileHandle);
    130         content[count] = '\0';
    131       }
    132       fclose(fileHandle);
    133     }
    134   }
    135   return content;
     120  if (fileName == NULL)
     121    return NULL;
     122
     123  fileHandle = fopen(fileName, "rt");
     124
     125  if (fileHandle == NULL)
     126    return NULL;
     127  fseek(fileHandle, 0, SEEK_END);
     128  count = ftell(fileHandle);
     129  rewind(fileHandle);
     130  if (count > 0) {
     131     content = new char[count+1];
     132     count = fread(content, sizeof(char), count, fileHandle);
     133     content[count] = '\0';
     134   }
     135   fclose(fileHandle);
     136 return content;
    136137}
    137138
  • trunk/src/world_entities/npc2.cc

    r5269 r5271  
    8888  shader->activateShader();
    8989  gluSphere(this->obj, 3, 10, 10);
    90   shader->deactivateShader();
     90  //shader->deactivateShader();
    9191
    9292
Note: See TracChangeset for help on using the changeset viewer.