From e7338896553efe18bd4ff72426e4e32f6d8d3910 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 18 Nov 2008 15:21:02 +0000 Subject: [PATCH] 2008-11-18 Emmanuele Bassi * clutter/cogl/cogl-shader.h: Add a function for setting an integer uniform, similar to cogl_program_uniform_1f(). * clutter/cogl/gl/cogl-program.c: Implement the GL version of cogl_program_uniform_1i(). * clutter/cogl/gles/cogl-program.c: Implement the GLES version of cogl_program_uniform_1i(). --- cogl-shader.h | 15 +++++++++++++-- gl/cogl-program.c | 8 ++++++++ gles/cogl-program.c | 7 +++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cogl-shader.h b/cogl-shader.h index 4c06abe1c..7678a6e25 100644 --- a/cogl-shader.h +++ b/cogl-shader.h @@ -218,12 +218,23 @@ COGLint cogl_program_get_uniform_location * @uniform_no: the unform to set. * @value: the new value of the uniform. * - * Changes the value of a uniform in the currently used (see - * cogl_program_use()) shader program. + * Changes the value of a floating point uniform in the currently + * used (see cogl_program_use()) shader program. */ void cogl_program_uniform_1f (COGLint uniform_no, gfloat value); +/** + * cogl_program_uniform_1i: + * @uniform_no: the unform to set. + * @value: the new value of the uniform. + * + * Changes the value of an integer uniform in the currently + * used (see cogl_program_use()) shader program. + */ +void cogl_program_uniform_1i (COGLint uniform_no, + gint value); + /** * cogl_program_uniform_float: * @uniform_no: the uniform to set. diff --git a/gl/cogl-program.c b/gl/cogl-program.c index 060e5bcd4..15f70f8fd 100644 --- a/gl/cogl-program.c +++ b/gl/cogl-program.c @@ -167,6 +167,14 @@ cogl_program_uniform_1f (COGLint uniform_no, glUniform1fARB (uniform_no, value); } +void +cogl_program_uniform_1i (COGLint uniform_no, + gint value) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + glUniform1iARB (uniform_no, value); +} + void cogl_program_uniform_float (COGLint uniform_no, gint size, diff --git a/gles/cogl-program.c b/gles/cogl-program.c index c550df453..63f2c0d45 100644 --- a/gles/cogl-program.c +++ b/gles/cogl-program.c @@ -166,6 +166,13 @@ cogl_program_uniform_1f (COGLint uniform_no, cogl_program_uniform_float (uniform_no, 1, 1, &value); } +void +cogl_program_uniform_1i (COGLint uniform_no, + gint value) +{ + cogl_program_uniform_int (uniform_no, 1, 1, &value); +} + static void cogl_program_uniform_x (COGLint uniform_no, gint size,