ld33_umonster
annotate src/shader.cc @ 0:4a6683050e29
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 22 Aug 2015 07:15:00 +0300 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #include "shader.h" |
nuclear@0 | 2 #include "sdr.h" |
nuclear@0 | 3 |
nuclear@0 | 4 static unsigned int cur_sdr; |
nuclear@0 | 5 static unsigned int sover; |
nuclear@0 | 6 |
nuclear@0 | 7 void set_shader(unsigned int sdr) |
nuclear@0 | 8 { |
nuclear@0 | 9 cur_sdr = sdr; |
nuclear@0 | 10 if(!sover) { |
nuclear@0 | 11 bind_program(sdr); |
nuclear@0 | 12 } |
nuclear@0 | 13 } |
nuclear@0 | 14 |
nuclear@0 | 15 unsigned int current_shader() |
nuclear@0 | 16 { |
nuclear@0 | 17 return sover ? sover : cur_sdr; |
nuclear@0 | 18 } |
nuclear@0 | 19 |
nuclear@0 | 20 void override_shader(unsigned int sdr) |
nuclear@0 | 21 { |
nuclear@0 | 22 sover = sdr; |
nuclear@0 | 23 if(sover) { |
nuclear@0 | 24 bind_program(sdr); |
nuclear@0 | 25 } else { |
nuclear@0 | 26 bind_program(cur_sdr); |
nuclear@0 | 27 } |
nuclear@0 | 28 } |