diff options
Diffstat (limited to 'glprog.c')
-rw-r--r-- | glprog.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -33,7 +33,7 @@ static const struct { { GL_TESS_EVALUATION_SHADER, "tese", false, "" }, { GL_GEOMETRY_SHADER, "geom", false, "" }, { GL_FRAGMENT_SHADER, "frag", true, -#define SH_TEX(type, name) "uniform sampler" #type " " #name ";\n" +#define SH_TEX(type, name) "uniform sampler" #type " t" #name ";\n" #define SH_OUT(type, name) "out " #type " " #name ";\n" #include "shaders/data.h" }, @@ -110,6 +110,7 @@ static void load_shader(struct shader *s, const char *path) GLint success, pos = 0; char log[LOGSIZE], *full, *src = NULL; size_t srclen = 0, fullsz; + GLint texture = 0; assert(s != NULL); assert(path != NULL); @@ -144,8 +145,10 @@ static void load_shader(struct shader *s, const char *path) detach_shaders(prog); + gl_prog_use(prog); + #define SH_UNI(_, name) s->uni.name = gl_uni_loc(prog, #name); -#define SH_TEX(_, name) s->tex.name = gl_uni_loc(prog, #name); +#define SH_TEX(_, name) gl_uni_set1i(gl_uni_loc(prog, "t" #name), texture++); #include "shaders/data.h" s->prog = prog; } |