From b2bebe0586cc531adb904aff8681dd77cf8169f3 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 6 Jun 2008 15:00:12 +0000 Subject: [PATCH] * tests/test-shader.c: Fixed to use sampler2D instead of sampler2DRect now that GL_TEXTURE_RECTANGLE support is disabled in revision 2834. The ClutterTexture actor now has the 'disable-slicing' property set. The distance in texture coordinates between pixels is passed in as a uniform so that the box-blur shader can still work. --- ChangeLog | 9 +++++++ tests/test-shader.c | 61 +++++++++++++++++++++++++++++++-------------- 2 files changed, 51 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a001e5c9..74bff6aa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-06-06 Neil Roberts + + * tests/test-shader.c: Fixed to use sampler2D instead of + sampler2DRect now that GL_TEXTURE_RECTANGLE support is disabled in + revision 2834. The ClutterTexture actor now has the + 'disable-slicing' property set. The distance in texture + coordinates between pixels is passed in as a uniform so that the + box-blur shader can still work. + 2008-06-06 Emmanuele Bassi Bug #952 - Fix test-textures in trunk diff --git a/tests/test-shader.c b/tests/test-shader.c index ceb6d0ef4..758c45977 100644 --- a/tests/test-shader.c +++ b/tests/test-shader.c @@ -22,12 +22,13 @@ typedef struct */ /* FRAGMENT_SHADER_BEGIN: generate boilerplate with a local vec4 color already - * initialized, from a sampler2DRect in a variable tex. + * initialized, from a sampler2D in a variable tex. */ -#define FRAGMENT_SHADER_BEGIN \ - "uniform sampler2DRect tex;" \ - "void main (){" \ - " vec4 color = texture2DRect (tex, vec2(gl_TexCoord[0].st));" +#define FRAGMENT_SHADER_BEGIN \ + "uniform sampler2D tex;" \ + "uniform float x_step, y_step;" \ + "void main (){" \ + " vec4 color = texture2D (tex, vec2(gl_TexCoord[0].st));" /* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly * blended with the gl specified color (makes the opacity of actors work @@ -57,29 +58,31 @@ static ShaderSource shaders[]= "for (u=-radius;ubutton.button == 1) { @@ -179,6 +184,19 @@ button_release_cb (ClutterActor *actor, clutter_actor_set_shader_param (actor, "radius", 3.0); clutter_actor_set_shader_param (actor, "brightness", 0.4); clutter_actor_set_shader_param (actor, "contrast", -1.9); + + if (CLUTTER_IS_TEXTURE (actor)) + { + tex_width = clutter_actor_get_width (actor); + tex_width = clutter_util_next_p2 (tex_width); + tex_height = clutter_actor_get_height (actor); + tex_height = clutter_util_next_p2 (tex_height); + + clutter_actor_set_shader_param (actor, "x_step", + 1.0f / tex_width); + clutter_actor_set_shader_param (actor, "y_step", + 1.0f / tex_height); + } } } return FALSE; @@ -229,9 +247,14 @@ main (gint argc, g_object_set (timeline, "loop", TRUE, NULL); /* have it loop */ #ifndef TEST_GROUP + actor = g_object_new (CLUTTER_TYPE_TEXTURE, + "filename", "redhand.png", + "disable-slicing", TRUE, + NULL); actor = clutter_texture_new_from_file ("redhand.png", &error); if (!actor) g_error("pixbuf load failed: %s", error ? error->message : "Unknown"); + #else actor = clutter_group_new (); {