Dear all,

I'm using clutter 1.2 with OpenGLES 2.0 as backend on a linux based ARM 
(freescale iMX51) embedded system and would like to use some shaders.
Unfortunately I encountered some problems and really strange behavior.

I'm using the following code, which I think is pretty basic and in my 
understanding should work:

#define FRAG_SHADER \
    "void main(void) { gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);}"

int main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *rect;

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();

  rect = clutter_rectangle_new_with_color(clutter_color_new(255,0,0,255));
  clutter_actor_set_size(rect, 300,300);
  clutter_container_add (CLUTTER_CONTAINER(stage), rect, NULL);

  ClutterActor *tex = clutter_texture_new_from_file ("redhand.png", NULL);

  ClutterShader *shader = clutter_shader_new();
  clutter_shader_set_fragment_source(shader, FRAG_SHADER, strlen(FRAG_SHADER));
//  clutter_shader_compile(shader, NULL);
  if (clutter_actor_set_shader(tex, shader)) g_print("shader applied\n");

  clutter_container_add (CLUTTER_CONTAINER (stage), tex, NULL);

  clutter_actor_show_all (CLUTTER_ACTOR (stage));

  clutter_main();
  return EXIT_SUCCESS;
}

Now, if I execute this little piece of code, i get the following result:
- the texture to which the shader should be applied (tex) remains unchanged
- the rectangle which should be red is blue, which i guess means, the shader 
gets applied to the rectangle.

If I use two rectangles instead of "one texture and one rectangle" and apply 
the shader to a rectangle, the shader has no effect at all.

It even gets stranger: if I execute this example with debug outputs enabled 
(e.g. "./shader_test --clutter-debug=shader or "--clutter-debug=actor") i get a 
critical error in the method "cogl_gles2_wrapper_get_program", BUT if i execute 
the program with "--clutter-debug=all" or no debug output I get the same 
behavior as described above without any errors.

I would really appreciate it if somebody has some hints, why I get this strange 
behavior. 
-- 
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt freischalten! http://portal.gmx.net/de/go/maxdome
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to