Re: [clutter] How to mask two texture
Rakesh Kumar wrote: Hi Samuel, Sorry for late reply I was on vacation. You have asked for two images dummy.png and dummy1.jpg. So for your reference I am attaching two images and Also I am attaching the final out put. Please comment on this. RK. Your dummy.png is quite wholly transparent, that's why the resulting image is also transparent. Here is how it works: the two images are *combined* together, so the RGBA value of the composed image is the 'multiplication' of the two images. (the two images are not displayed one *over* the other). It means that the final image gets the transparency of dummy.png. dummy.png should be a mask : white where your want to see dummy1.png, fully transparent where you want to see the background. (and half-transparent where you want to *add* transparency to dummy1.png) Do you understand ? (my english is not very good...) -- To unsubscribe send a mail to clutter+unsubscr...@o-hand.com
RE: [clutter] How to mask two texture
Thanks for your quick reply.I have just given a thought We are modulating the two images so any way it will get Color of both image.I have tried alpha test also but its not worked. I think I should try some different method. Rakesh Kumar wrote: Hi Samuel, Sorry for late reply I was on vacation. You have asked for two images dummy.png and dummy1.jpg. So for your reference I am attaching two images and Also I am attaching the final out put. Please comment on this. RK. Your dummy.png is quite wholly transparent, that's why the resulting image is also transparent. Here is how it works: the two images are *combined* together, so the RGBA value of the composed image is the 'multiplication' of the two images. (the two images are not displayed one *over* the other). It means that the final image gets the transparency of dummy.png. dummy.png should be a mask : white where your want to see dummy1.png, fully transparent where you want to see the background. (and half-transparent where you want to *add* transparency to dummy1.png) These four lines I didn't understand. Do you understand ? (my english is not very good...) -- To unsubscribe send a mail to clutter+unsubscr...@o-hand.com
Re: [clutter] How to mask two texture
Rakesh Kumar wrote: Thanks for your quick reply.I have just given a thought We are modulating the two images so any way it will get Color of both image.I have tried alpha test also but its not worked. I think I should try some different method. I think you need 3 layers : - the basic image - composed with a second layer to add 'lightning' - composed with a 'scissor' mask Rakesh Kumar wrote: Hi Samuel, Sorry for late reply I was on vacation. You have asked for two images dummy.png and dummy1.jpg. So for your reference I am attaching two images and Also I am attaching the final out put. Please comment on this. RK. Your dummy.png is quite wholly transparent, that's why the resulting image is also transparent. Here is how it works: the two images are *combined* together, so the RGBA value of the composed image is the 'multiplication' of the two images. (the two images are not displayed one *over* the other). It means that the final image gets the transparency of dummy.png. dummy.png should be a mask : white where your want to see dummy1.png, fully transparent where you want to see the background. (and half-transparent where you want to *add* transparency to dummy1.png) These four lines I didn't understand. Do you understand ? (my english is not very good...) -- To unsubscribe send a mail to clutter+unsubscr...@o-hand.com
RE: [clutter] How to mask two texture
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
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
RE: [clutter] How to mask two texture
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)); /* 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
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
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)); /* 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