goat3dgfx
diff src/sdrman.cc @ 0:1873dfd13f2d
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 14 Nov 2013 05:27:09 +0200 |
parents | |
children | 7d6b667821cf |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/sdrman.cc Thu Nov 14 05:27:09 2013 +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 +}