goat3dgfx

annotate 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
rev   line source
nuclear@0 1 #include "sdrman.h"
nuclear@0 2
nuclear@0 3 ShaderSet vsdrset(GL_VERTEX_SHADER);
nuclear@0 4 ShaderSet psdrset(GL_FRAGMENT_SHADER);
nuclear@0 5
nuclear@0 6 ShaderProg *get_sdrprog(const char *vname, const char *pname)
nuclear@0 7 {
nuclear@0 8 Shader *vsdr = vname ? vsdrset.get(vname) : 0;
nuclear@0 9 Shader *psdr = pname ? psdrset.get(pname) : 0;
nuclear@0 10
nuclear@0 11 if(vname && !vsdr) {
nuclear@0 12 return 0;
nuclear@0 13 }
nuclear@0 14 if(pname && !psdr) {
nuclear@0 15 return 0;
nuclear@0 16 }
nuclear@0 17 if(!vsdr && !psdr) {
nuclear@0 18 return 0;
nuclear@0 19 }
nuclear@0 20
nuclear@0 21 ShaderProg *prog = new ShaderProg;
nuclear@0 22 if(!prog->create(vsdr, psdr)) {
nuclear@0 23 delete prog;
nuclear@0 24 return 0;
nuclear@0 25 }
nuclear@0 26 return prog;
nuclear@0 27 }