vrshoot

diff src/sdrman.cc @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/sdrman.cc	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,27 @@
     1.4 +#include "sdrman.h"
     1.5 +
     1.6 +ShaderSet vsdrset(GL_VERTEX_SHADER);
     1.7 +ShaderSet psdrset(GL_FRAGMENT_SHADER);
     1.8 +
     1.9 +ShaderProg *get_sdrprog(const char *vname, const char *pname)
    1.10 +{
    1.11 +	Shader *vsdr = vname ? vsdrset.get(vname) : 0;
    1.12 +	Shader *psdr = pname ? psdrset.get(pname) : 0;
    1.13 +
    1.14 +	if(vname && !vsdr) {
    1.15 +		return 0;
    1.16 +	}
    1.17 +	if(pname && !psdr) {
    1.18 +		return 0;
    1.19 +	}
    1.20 +	if(!vsdr && !psdr) {
    1.21 +		return 0;
    1.22 +	}
    1.23 +
    1.24 +	ShaderProg *prog = new ShaderProg;
    1.25 +	if(!prog->create(vsdr, psdr)) {
    1.26 +		delete prog;
    1.27 +		return 0;
    1.28 +	}
    1.29 +	return prog;
    1.30 +}