c - Efficient reflections in Clutter/COGL? -


i'm working on program uses clutter (1.10) , cogl render elements display.

i've created set of cluttertextures rendering video to, , i'd video textures have reflections.

the "standard" way implement seems callback every time texture painted, code similar to:

static void texture_paint_cb (clutteractor *actor ) {     cluttergeometry geom;     coglhandle cmaterial;     coglhandle ctexture;     gfloat squish = 1.5;      cogl_push_matrix ();      clutter_actor_get_allocation_geometry (actor, &geom);      guint8 opacity = clutter_actor_get_paint_opacity (actor);     opacity /= 2;      cogltexturevertex vertices[] =     {          { geom.width, geom.height,     0,  1, 1 },         { 0,          geom.height,     0,  0, 1 },         { 0,          geom.height*squish, 0,  0, 0 },         { geom.width, geom.height*squish, 0,  1, 0 }      };      cogl_color_set_from_4ub (&vertices[0].color, opacity, opacity, opacity, opacity);     cogl_color_set_from_4ub (&vertices[1].color, opacity, opacity, opacity, opacity);     cogl_color_set_from_4ub (&vertices[2].color, 0, 0, 0, 0);     cogl_color_set_from_4ub (&vertices[3].color, 0, 0, 0, 0);      cmaterial = clutter_texture_get_cogl_material (clutter_texture (actor));     ctexture  = clutter_texture_get_cogl_texture  (clutter_texture (actor));      cogl_material_set_layer (cmaterial, 0, ctexture);     cogl_set_source(cmaterial);     cogl_set_source_texture(ctexture);     cogl_polygon (vertices, g_n_elements (vertices), true);      cogl_pop_matrix (); } 

this hooked paint signal on cluttertexture. there's similar bit of code here similar. (google cache, since page has been down today)

the problem i'm having reflection effect causing performance hit - 5~7 fps being lost when enable it. part of problem low-power hardware i'm using (a raspberry pi).

i've managed similar code does, setting clone of texture , making transparent. causes no performance hit whatsoever. however, unlike paint callback method, reflection has hard edges , doesn't fade out.

i'd better looking reflection effect without performance hit. i'm wondering if there's way similar effect doesn't require work per paint... there bunch of other clutter , cogl methods manipulate materials, shaders, , forth, have little no opengl expertise don't have idea if along lines want, or how find examples of similar work off of.

is possible better looking, high performance reflection effect via clutter/cogl?


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -