ld33_umonster
diff src/object.cc @ 2:35349df5392d
wtf?
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 22 Aug 2015 23:55:21 +0300 |
parents | 4a6683050e29 |
children |
line diff
1.1 --- a/src/object.cc Sat Aug 22 23:17:57 2015 +0300 1.2 +++ b/src/object.cc Sat Aug 22 23:55:21 2015 +0300 1.3 @@ -1,6 +1,7 @@ 1.4 #include "object.h" 1.5 #include "opengl.h" 1.6 #include "shadow.h" 1.7 +#include "shader.h" 1.8 1.9 Material::Material() 1.10 : diffuse(1, 1, 1), specular(0, 0, 0) 1.11 @@ -102,10 +103,10 @@ 1.12 if(glcaps.shaders) { 1.13 if(sdr) { 1.14 if(!shadow_pass) { 1.15 - glUseProgram(sdr); 1.16 + ::set_shader(sdr); 1.17 } 1.18 } else { 1.19 - glUseProgram(0); 1.20 + ::set_shader(0); 1.21 } 1.22 } 1.23 1.24 @@ -140,7 +141,7 @@ 1.25 } 1.26 1.27 if(sdr) { 1.28 - glUseProgram(0); 1.29 + ::set_shader(0); 1.30 } 1.31 1.32 glMatrixMode(GL_MODELVIEW); 1.33 @@ -187,6 +188,10 @@ 1.34 1.35 void Object::draw_normals(float len, const Vector4 &col) const 1.36 { 1.37 + int cur_sdr; 1.38 + glGetIntegerv(GL_CURRENT_PROGRAM, &cur_sdr); 1.39 + glUseProgram(0); 1.40 + 1.41 glPushAttrib(GL_ENABLE_BIT); 1.42 glDisable(GL_LIGHTING); 1.43 1.44 @@ -200,6 +205,8 @@ 1.45 1.46 glPopMatrix(); 1.47 glPopAttrib(); 1.48 + 1.49 + glUseProgram(cur_sdr); 1.50 } 1.51 1.52 void Object::draw_tangents(float len, const Vector4 &col) const