ld33_umonster

diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/shader.cc	Sat Aug 22 07:15:00 2015 +0300
     1.3 @@ -0,0 +1,28 @@
     1.4 +#include "shader.h"
     1.5 +#include "sdr.h"
     1.6 +
     1.7 +static unsigned int cur_sdr;
     1.8 +static unsigned int sover;
     1.9 +
    1.10 +void set_shader(unsigned int sdr)
    1.11 +{
    1.12 +	cur_sdr = sdr;
    1.13 +	if(!sover) {
    1.14 +		bind_program(sdr);
    1.15 +	}
    1.16 +}
    1.17 +
    1.18 +unsigned int current_shader()
    1.19 +{
    1.20 +	return sover ? sover : cur_sdr;
    1.21 +}
    1.22 +
    1.23 +void override_shader(unsigned int sdr)
    1.24 +{
    1.25 +	sover = sdr;
    1.26 +	if(sover) {
    1.27 +		bind_program(sdr);
    1.28 +	} else {
    1.29 +		bind_program(cur_sdr);
    1.30 +	}
    1.31 +}