- Timestamp:
- Oct 1, 2005, 10:39:27 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure
r5271 r5273 5446 5446 echo "${ECHO_T}$ac_cv_lib_glew32_main" >&6 5447 5447 if test $ac_cv_lib_glew32_main = yes; then 5448 echo "$as_me:$LINENO: checking for main in -lglew32s" >&55449 echo $ECHO_N "checking for main in -lglew32s... $ECHO_C" >&65450 if test "${ac_cv_lib_glew32s_main+set}" = set; then5451 echo $ECHO_N "(cached) $ECHO_C" >&65452 else5453 ac_check_lib_save_LIBS=$LIBS5454 LIBS="-lglew32s $LIBS"5455 cat >conftest.$ac_ext <<_ACEOF5456 /* confdefs.h. */5457 _ACEOF5458 cat confdefs.h >>conftest.$ac_ext5459 cat >>conftest.$ac_ext <<_ACEOF5460 /* end confdefs.h. */5461 5462 5463 int5464 main ()5465 {5466 main ();5467 ;5468 return 0;5469 }5470 _ACEOF5471 rm -f conftest.$ac_objext conftest$ac_exeext5472 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&55473 (eval $ac_link) 2>conftest.er15474 ac_status=$?5475 grep -v '^ *+' conftest.er1 >conftest.err5476 rm -f conftest.er15477 cat conftest.err >&55478 echo "$as_me:$LINENO: \$? = $ac_status" >&55479 (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\"") >&55483 (eval $ac_try) 2>&55484 ac_status=$?5485 echo "$as_me:$LINENO: \$? = $ac_status" >&55486 (exit $ac_status); }; } &&5487 { ac_try='test -s conftest$ac_exeext'5488 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&55489 (eval $ac_try) 2>&55490 ac_status=$?5491 echo "$as_me:$LINENO: \$? = $ac_status" >&55492 (exit $ac_status); }; }; then5493 ac_cv_lib_glew32s_main=yes5494 else5495 echo "$as_me: failed program was:" >&55496 sed 's/^/| /' conftest.$ac_ext >&55497 5498 ac_cv_lib_glew32s_main=no5499 fi5500 rm -f conftest.err conftest.$ac_objext \5501 conftest$ac_exeext conftest.$ac_ext5502 LIBS=$ac_check_lib_save_LIBS5503 fi5504 echo "$as_me:$LINENO: result: $ac_cv_lib_glew32s_main" >&55505 echo "${ECHO_T}$ac_cv_lib_glew32s_main" >&65506 if test $ac_cv_lib_glew32s_main = yes; then5507 5448 FOUND_glew32=yes 5508 5449 fi 5509 5450 5510 fi5511 5512 5451 if test x$FOUND_glew32 = xyes ; then 5513 LIBS="$LIBS -lglew32 -lglew32s"5452 LIBS="$LIBS -lglew32" 5514 5453 else 5515 5454 echo "------------------" -
trunk/src/lib/graphics/shader.cc
r5271 r5273 19 19 20 20 #include "stdlibincl.h" 21 #include "compiler.h" 21 22 #include <stdio.h> 22 23 #include "debug.h" … … 44 45 45 46 if (GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100) 46 this->shaderProgram = glCreateProgramObjectARB(); 47 48 if (vertexShaderFile != NULL) 49 this->loadShaderProgramm(SHADER_VERTEX, vertexShaderFile); 50 if (fragmentShaderFile != NULL) 51 this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile); 52 try { 53 glLinkProgramARB(this->shaderProgram); } 54 catch(GLenum errorCode) { 55 this->printError(this->shaderProgram); } 47 { 48 this->shaderProgram = glCreateProgramObjectARB(); 49 50 if (vertexShaderFile != NULL) 51 this->loadShaderProgramm(SHADER_VERTEX, vertexShaderFile); 52 if (fragmentShaderFile != NULL) 53 this->loadShaderProgramm(SHADER_FRAGMENT, fragmentShaderFile); 54 try { 55 glLinkProgramARB(this->shaderProgram); } 56 catch(GLenum errorCode) { 57 this->printError(this->shaderProgram); } 58 } 59 else 60 { 61 PRINTF(2)("Shaders are not supported on your hardware\n"); 62 } 56 63 } 57 64 … … 66 73 this->deleteProgram(SHADER_FRAGMENT); 67 74 68 glDeleteObjectARB(this->fragmentShader); 69 glDeleteObjectARB(this->vertexShader); 70 glDeleteObjectARB(this->shaderProgram); 75 if (this->fragmentShader != 0) 76 glDeleteObjectARB(this->fragmentShader); 77 if (this->vertexShader != 0) 78 glDeleteObjectARB(this->vertexShader); 79 if (this->shaderProgram != 0) 80 glDeleteObjectARB(this->shaderProgram); 71 81 } 72 82 … … 98 108 shader = this->fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); 99 109 } 100 glShaderSourceARB(shader, 1, (const GLcharARB**)&program, NULL); 101 try { 102 glCompileShaderARB(shader); 103 } 104 catch (...) 105 { 106 this->printError(shader); 107 } 108 glAttachObjectARB(this->shaderProgram, shader); 109 delete[] program; 110 } 111 110 111 if (shader != 0) 112 { 113 glShaderSourceARB(shader, 1, (const GLcharARB**)&program, NULL); 114 try { 115 glCompileShaderARB(shader); 116 } 117 catch (...) 118 { 119 this->printError(shader); 120 } 121 glAttachObjectARB(this->shaderProgram, shader); 122 delete[] program; 123 } 124 } 112 125 113 126 char* Shader::fileRead(const char* fileName) … … 139 152 void Shader::activateShader() 140 153 { 141 glUseProgramObjectARB(this->shaderProgram); 154 if (likely (this->shaderProgram != 0)) 155 glUseProgramObjectARB(this->shaderProgram); 142 156 } 143 157 … … 150 164 void Shader::deleteProgram(SHADER_TYPE type) 151 165 { 152 if (type == SHADER_VERTEX )166 if (type == SHADER_VERTEX && this->vertexShader != 0) 153 167 { 154 168 delete[] this->vertexShaderFile; … … 157 171 this->vertexShader = 0; 158 172 } 159 else if (type == SHADER_FRAGMENT )173 else if (type == SHADER_FRAGMENT && this->fragmentShader != 0) 160 174 { 161 175 delete[] this->fragmentShaderFile; … … 171 185 void Shader::printError(GLenum program) 172 186 { 187 if (program == 0) 188 return; 189 173 190 int infologLength = 0; 174 191 int charsWritten = 0; … … 206 223 PRINT(3)("%d: %s\n", i, this->fragmentShaderSource->getEntry(i));*/ 207 224 } 208 209 210 } 211 225 } 226
Note: See TracChangeset
for help on using the changeset viewer.