+static void rc_prepare_post_process_lut(RendererClutter *rc)
+{
+ PixbufRenderer *pr = rc->pr;
+ static guchar clut[CLUT_SIZE * CLUT_SIZE * CLUT_SIZE * 3];
+ guint r, g, b;
+ GdkPixbuf *tmp_pixbuf;
+ CoglHandle material;
+ CoglHandle tex3d;
+
+ DEBUG_0("%s clut start", get_exec_time());
+
+ for (r = 0; r < CLUT_SIZE; r++)
+ {
+ for (g = 0; g < CLUT_SIZE; g++)
+ {
+ for (b = 0; b < CLUT_SIZE; b++)
+ {
+ guchar *ptr = clut + ((b * CLUT_SIZE + g) * CLUT_SIZE + r) * 3;
+ ptr[0] = floor ((double) r / (CLUT_SIZE - 1) * 255.0 + 0.5);
+ ptr[1] = floor ((double) g / (CLUT_SIZE - 1) * 255.0 + 0.5);
+ ptr[2] = floor ((double) b / (CLUT_SIZE - 1) * 255.0 + 0.5);
+ }
+ }
+ }
+ tmp_pixbuf = gdk_pixbuf_new_from_data(clut, GDK_COLORSPACE_RGB, FALSE, 8,
+ CLUT_SIZE * CLUT_SIZE,
+ CLUT_SIZE,
+ CLUT_SIZE * CLUT_SIZE * 3,
+ NULL, NULL);
+ if (pr->func_post_process)
+ {
+ pr->func_post_process(pr, &tmp_pixbuf, 0, 0, CLUT_SIZE * CLUT_SIZE, CLUT_SIZE, pr->post_process_user_data);
+ }
+ g_object_unref(tmp_pixbuf);
+
+ DEBUG_0("%s clut upload start", get_exec_time());
+
+ tex3d = cogl_texture_3d_new_from_data(CLUT_SIZE, CLUT_SIZE, CLUT_SIZE,
+ COGL_TEXTURE_NONE,
+ COGL_PIXEL_FORMAT_RGB_888,
+ COGL_PIXEL_FORMAT_RGB_888,
+ CLUT_SIZE * 3,
+ CLUT_SIZE * CLUT_SIZE * 3,
+ clut,
+ NULL);
+ material = clutter_texture_get_cogl_material(rc->texture);
+ cogl_material_set_layer(material, 1, tex3d);
+ cogl_handle_unref(tex3d);
+ DEBUG_0("%s clut end", get_exec_time());
+ rc->clut_updated = TRUE;
+}
+
+
+