RE: [clutter] How to mask two texture

2010-05-21 Thread Rakesh Kumar
Hi Samuel,
 
 Now I am getting the masking but its also blended 
 With the stage color. Stage color is coming on masked
 Image. Any help will be appreciated.
Regards,
RK. 


Rakesh Kumar wrote:
  
 Hi Neil,
  
 I have done like this but I am not getting masking in my program.
 Code Snippet:In the loading image
   
 Load_Image()
 {
 gchar **files;
 files = g_new (gchar*, 1);
 
  files[0] = g_build_filename (/home/rakeshk4/Development/Pictureflow/, 
 Dummy_Alpha_Path.png, NULL);
 
 //path I am geeting from argument
 ClutterActor *actor = clutter_texture_new_from_file (path, NULL);
 
 CoglHandle alpha_mask_texture =  cogl_texture_new_from_file 
 (files[0],COGL_TEXTURE_NONE, COGL_PIXEL_FORMAT_ANY,error);
 
   
 Coglhandle material = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE 
 (actor));
 
 cogl_material_set_layer (material, 1, alpha_mask_texture);
 cogl_material_set_layer_combine (material, 1,
RGBA = MODULATE (PREVIOUS, TEXTURE),
error);
 
 I am getting this warning meassage:
 cogl_material_set_layer_combine: assertion `cogl_is_material (handle)'failed
 
 I am using this sample.
 http://github.com/pmarti/clutter-tutorial/tree/50679e5eb5ebeb9cbfaab99ceacd9e85deabf3bb/examples/full_example
 
 
 Regards,
 RK
 
 Hi
 
 Rakesh Kumar rakesh.ku...@kpitcummins.com wrote:
 
 I have two texture one is rectangular texture and other one contains
 alpha texture that is non rectangular texture ,from this i would like
 to mask two texture and create new shape texture. How we can do this
 in clutter.
 
 You should be able to do this with a custom material on a ClutterTexture
 using multi-texturing. Assuming you have your alpha mask texture in a
 CoglHandle and your base texture in a ClutterTexture you can do
 something like this:
 
 ClutterActor *base_texture = ...;
 CoglHandle alpha_mask_texture = ...;
 CoglHandle material;
 
 /* Get the material from the Clutter texture */
 material =
   clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (base_texture));

maaterial = clutter_texture_get_cogl_material (CLUTTER_TEXTURE 
(base_texture));

that could fix the error, afaik...

 /* Add the alpha mask as a second texture layer */
 cogl_material_set_layer (material, 1, alpha_mask_texture);
 /* Set the combine function so that the base texture is modulated by the
alpha component of the mask texture */
 cogl_material_set_layer_combine (material, 1,
  RGBA = MODULATE (PREVIOUS, TEXTURE[A]),
  NULL);
 
 If you need picking to work as well then you would need to subclass
 ClutterTextue and override the pick method so that it draws a solid
 rectangle masked by the alpha texture in a similar way.
 
 You may want to take a look at Mutter¹ which does a similar thing to
 support shaped windows.
 
 - Neil
 
 ¹ http://ho.io/ck29
 
 



--
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com



Re: [clutter] How to mask two texture

2010-05-21 Thread Samuel Degrande

Rakesh Kumar wrote:

Hi Samuel,
 
 Now I am getting the masking but its also blended 
 With the stage color. Stage color is coming on masked

 Image. Any help will be appreciated.
Regards,
RK. 



How would you like it to work ? If you have transparency, then you'll
see what is displayed behind the transparent part. Or perhaps I do not
understand what you're trying to do...

--
To unsubscribe send a mail to clutter+unsubscr...@o-hand.com