goat3dgfx
annotate src/sdrman.cc @ 34:3eb6c8f89fe1
merge
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 02 Mar 2014 17:41:10 +0200 |
parents | 1873dfd13f2d |
children |
rev | line source |
---|---|
nuclear@0 | 1 #include "sdrman.h" |
nuclear@0 | 2 |
nuclear@15 | 3 using namespace goatgfx; |
nuclear@15 | 4 |
nuclear@15 | 5 namespace goatgfx { |
nuclear@15 | 6 |
nuclear@0 | 7 ShaderSet vsdrset(GL_VERTEX_SHADER); |
nuclear@0 | 8 ShaderSet psdrset(GL_FRAGMENT_SHADER); |
nuclear@0 | 9 |
nuclear@0 | 10 ShaderProg *get_sdrprog(const char *vname, const char *pname) |
nuclear@0 | 11 { |
nuclear@0 | 12 Shader *vsdr = vname ? vsdrset.get(vname) : 0; |
nuclear@0 | 13 Shader *psdr = pname ? psdrset.get(pname) : 0; |
nuclear@0 | 14 |
nuclear@0 | 15 if(vname && !vsdr) { |
nuclear@0 | 16 return 0; |
nuclear@0 | 17 } |
nuclear@0 | 18 if(pname && !psdr) { |
nuclear@0 | 19 return 0; |
nuclear@0 | 20 } |
nuclear@0 | 21 if(!vsdr && !psdr) { |
nuclear@0 | 22 return 0; |
nuclear@0 | 23 } |
nuclear@0 | 24 |
nuclear@0 | 25 ShaderProg *prog = new ShaderProg; |
nuclear@0 | 26 if(!prog->create(vsdr, psdr)) { |
nuclear@0 | 27 delete prog; |
nuclear@0 | 28 return 0; |
nuclear@0 | 29 } |
nuclear@0 | 30 return prog; |
nuclear@0 | 31 } |
nuclear@15 | 32 |
nuclear@15 | 33 } // namespace goatgfx |