diff options
author | Zack Rusin <[email protected]> | 2008-06-12 00:04:30 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2008-06-12 14:15:37 -0400 |
commit | f49dd47dc936587cd9eabddfe370651efc612f9f (patch) | |
tree | 62e80e914a1b3d164d5f87878c6c5dad7f1d12c5 /progs/vpglsl/vp-tris.c | |
parent | 38fdf130d4016197e9ecfa6beeade0362f9622eb (diff) |
add some glsl example testing different arrays of uniforms
Diffstat (limited to 'progs/vpglsl/vp-tris.c')
-rw-r--r-- | progs/vpglsl/vp-tris.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/progs/vpglsl/vp-tris.c b/progs/vpglsl/vp-tris.c index 3c2830773a3..9108d3f1978 100644 --- a/progs/vpglsl/vp-tris.c +++ b/progs/vpglsl/vp-tris.c @@ -76,6 +76,52 @@ static void check_link(GLuint prog) } } +static void setup_uniforms() +{ + { + GLuint loc1f = glGetUniformLocationARB(program, "Offset1f"); + GLuint loc2f = glGetUniformLocationARB(program, "Offset2f"); + GLuint loc4f = glGetUniformLocationARB(program, "Offset4f"); + GLfloat vecKer[] = + { 1.0, 0.0, 0.0, 1.0, + 0.0, 1.0, 0.0, 1.0, + 1.0, 0.0, 0.0, 1.0, + 0.0, 0.0, 0.0, 1.0 + }; + if (loc1f >= 0) + glUniform1fv(loc1f, 16, vecKer); + + if (loc2f >= 0) + glUniform2fv(loc2f, 8, vecKer); + + if (loc4f >= 0) + glUniform4fv(loc4f, 4, vecKer); + + } + + GLuint loc1f = glGetUniformLocationARB(program, "KernelValue1f"); + GLuint loc2f = glGetUniformLocationARB(program, "KernelValue2f"); + GLuint loc4f = glGetUniformLocationARB(program, "KernelValue4f"); + GLfloat vecKer[] = + { 1.0, 0.0, 0.0, 0.25, + 0.0, 1.0, 0.0, 0.25, + 0.0, 0.0, 1.0, 0.25, + 0.0, 0.0, 0.0, 0.25, + 0.5, 0.0, 0.0, 0.35, + 0.0, 0.5, 0.0, 0.35, + 0.0, 0.0, 0.5, 0.35, + 0.0, 0.0, 0.0, 0.35 + }; + if (loc1f >= 0) + glUniform1fv(loc1f, 16, vecKer); + + if (loc2f >= 0) + glUniform2fv(loc2f, 8, vecKer); + + if (loc4f >= 0) + glUniform4fv(loc4f, 4, vecKer); +} + static void prepare_shaders() { static const char *fragShaderText = @@ -103,6 +149,8 @@ static void prepare_shaders() glLinkProgram(program); check_link(program); glUseProgram(program); + + setup_uniforms(); } static void args(int argc, char *argv[]) |