Hello,
how is it possible to flip upside down an image in glsl example 05.multitexture
I tried to implement this in fragment program:
http://stackoverflow.com/questions/9857089/flip-upside-down-vertex-shader-gl...
but it doesn't work. The only thing I can do is changing texture scale and position, but I couldn't do it with negative values like it would be done in pix_coordinates.
In fact when I use pix_multiimage before pix_texture, the image gets flipped, I don't know why...
Colet Patrice
hello,
when using rectangular texturing, coordinate goes from 0 to image pixel size. when using "rectangle 0" mode, pixel coordinate goes from 0 to 1. (sometimes 1 is for the power of 2 bigger than the image pixel size)
so, in rectangular mode, use pixetl_size - image coordinate to flip the image. and 1 - image coordinate in non rectangle mode.
Image can be fliped because the "fliped" flag is not used on the shader.
cheers c
Le 08/04/2013 09:24, Patrice Colet a écrit :
Hello,
how is it possible to flip upside down an image in glsl example 05.multitexture
I tried to implement this in fragment program:
http://stackoverflow.com/questions/9857089/flip-upside-down-vertex-shader-gl...
but it doesn't work. The only thing I can do is changing texture scale and position, but I couldn't do it with negative values like it would be done in pix_coordinates.
In fact when I use pix_multiimage before pix_texture, the image gets flipped, I don't know why...
Colet Patrice
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Got it, thanks a lot!
Colet Patrice
----- Mail original -----
De: "Cyrille Henry" ch@chnry.net À: "Patrice Colet" colet.patrice@free.fr Cc: "pd-list" pd-list@iem.at Envoyé: Lundi 8 Avril 2013 10:05:22 Objet: Re: [PD] flip image in glsl
hello,
when using rectangular texturing, coordinate goes from 0 to image pixel size. when using "rectangle 0" mode, pixel coordinate goes from 0 to 1. (sometimes 1 is for the power of 2 bigger than the image pixel size)
so, in rectangular mode, use pixetl_size - image coordinate to flip the image. and 1 - image coordinate in non rectangle mode.
Image can be fliped because the "fliped" flag is not used on the shader.
cheers c
Le 08/04/2013 09:24, Patrice Colet a écrit :
Hello,
how is it possible to flip upside down an image in glsl example 05.multitexture
I tried to implement this in fragment program:
http://stackoverflow.com/questions/9857089/flip-upside-down-vertex-shader-gl...
but it doesn't work. The only thing I can do is changing texture scale and position, but I couldn't do it with negative values like it would be done in pix_coordinates.
In fact when I use pix_multiimage before pix_texture, the image gets flipped, I don't know why...
Colet Patrice
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
I've implemented all the stuff for flipping horizontaly and verticaly, there is an attached example, but it's not very elegant, there is warning messages even if it works good, maybe there is a better way to do it?
Colet Patrice
----- Mail original -----
De: "Patrice Colet" colet.patrice@free.fr À: "pd-list" pd-list@iem.at Cc: "Cyrille Henry" ch@chnry.net Envoyé: Lundi 8 Avril 2013 16:37:29 Objet: Re: [PD] flip image in glsl
Got it, thanks a lot!
Colet Patrice
----- Mail original -----
De: "Cyrille Henry" ch@chnry.net À: "Patrice Colet" colet.patrice@free.fr Cc: "pd-list" pd-list@iem.at Envoyé: Lundi 8 Avril 2013 10:05:22 Objet: Re: [PD] flip image in glsl
hello,
when using rectangular texturing, coordinate goes from 0 to image pixel size. when using "rectangle 0" mode, pixel coordinate goes from 0 to 1. (sometimes 1 is for the power of 2 bigger than the image pixel size)
so, in rectangular mode, use pixetl_size - image coordinate to flip the image. and 1 - image coordinate in non rectangle mode.
Image can be fliped because the "fliped" flag is not used on the shader.
cheers c
Le 08/04/2013 09:24, Patrice Colet a écrit :
Hello,
how is it possible to flip upside down an image in glsl example 05.multitexture
I tried to implement this in fragment program:
http://stackoverflow.com/questions/9857089/flip-upside-down-vertex-shader-gl...
but it doesn't work. The only thing I can do is changing texture scale and position, but I couldn't do it with negative values like it would be done in pix_coordinates.
In fact when I use pix_multiimage before pix_texture, the image gets flipped, I don't know why...
Colet Patrice
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Le 08/04/2013 17:47, Patrice Colet a écrit :
I've implemented all the stuff for flipping horizontaly and verticaly, there is an attached example, but it's not very elegant, there is warning messages even if it works good, maybe there is a better way to do it?
Colet Patrice
----- Mail original -----
De: "Patrice Colet" colet.patrice@free.fr À: "pd-list" pd-list@iem.at Cc: "Cyrille Henry" ch@chnry.net Envoyé: Lundi 8 Avril 2013 16:37:29 Objet: Re: [PD] flip image in glsl
Got it, thanks a lot!
Colet Patrice
----- Mail original -----
De: "Cyrille Henry" ch@chnry.net À: "Patrice Colet" colet.patrice@free.fr Cc: "pd-list" pd-list@iem.at Envoyé: Lundi 8 Avril 2013 10:05:22 Objet: Re: [PD] flip image in glsl
hello,
when using rectangular texturing, coordinate goes from 0 to image pixel size. when using "rectangle 0" mode, pixel coordinate goes from 0 to 1. (sometimes 1 is for the power of 2 bigger than the image pixel size)
so, in rectangular mode, use pixetl_size - image coordinate to flip the image. and 1 - image coordinate in non rectangle mode.
Image can be fliped because the "fliped" flag is not used on the shader.
cheers c
Le 08/04/2013 09:24, Patrice Colet a écrit :
Hello,
how is it possible to flip upside down an image in glsl example 05.multitexture
I tried to implement this in fragment program:
http://stackoverflow.com/questions/9857089/flip-upside-down-vertex-shader-gl...
but it doesn't work. The only thing I can do is changing texture scale and position, but I couldn't do it with negative values like it would be done in pix_coordinates.
In fact when I use pix_multiimage before pix_texture, the image gets flipped, I don't know why...
Colet Patrice
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hello Patrice,
You can do operations directly on vec2 instead of two floats in your fragment shader. You can also avoid condition (could be slow). See patch and glsl vertex and fragment attached for flip. ++
Jack
Hi Jack,
the fragment code is now very short and much more elegant, certainly faster than using conditions, I guess this is due to [pix_info] that is computing dimensions of the resulting texture. This procedure seems to work for horizontal flipping then corrects strange behavior between pix_image and glsl, but vertical flipping has no consequence. It's also possible to crop using the dimen parameter, but I believe there is a zoom parameter missing to do it entirely. So I'm going to restart coding a fragment code from the basis you propose that would allow to crop both textures, because this looks fundamental for my possible use of this object, that is mainly about mixing two textures which coordinates could be modulated to fit a particular context, where textures would need to be placed accurately without having to modify it in an image editor, maybe you have an idea about how to do it simply?
You can do operations directly on vec2 instead of two floats in your fragment shader. You can also avoid condition (could be slow). See patch and glsl vertex and fragment attached for flip. ++
Jack
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Le 10/04/2013 07:48, Patrice Colet a écrit :
Hi Jack,
the fragment code is now very short and much more elegant, certainly faster than using conditions, I guess this is due to [pix_info] that is computing dimensions of the resulting texture. This procedure seems to work for horizontal flipping then corrects strange behavior between pix_image and glsl, but vertical flipping has no consequence. It's also possible to crop using the dimen parameter, but I believe there is a zoom parameter missing to do it entirely. So I'm going to restart coding a fragment code from the basis you propose that would allow to crop both textures, because this looks fundamental for my possible use of this object, that is mainly about mixing two textures which coordinates could be modulated to fit a particular context, where textures would need to be placed accurately without having to modify it in an image editor, maybe you have an idea about how to do it simply?
You can do operations directly on vec2 instead of two floats in your fragment shader. You can also avoid condition (could be slow). See patch and glsl vertex and fragment attached for flip. ++
Jack
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->open http://lists.puredata.info/listinfo/pd-list
Hello Patrice,
Not sure to understand what you mean about the problem on horizontal/vertical flipping. Here a new patch and the fragment shader. This time, all is computed from the Gem window size. You can flip, scale and move each texture. (the flip is done from the center position of the Gemwin). In this patch, i use a workaround to avoid to see the 'border' of the texture thanks to the message [perspec( on [gemframebuffer]. I don't know if there is a better solution ? Hope it will help. ++
Jack
PS : I can clean the this patch and keep only the part about position and scale of a texture with GLSL for Gem example if it is interesting ?
Hello Jack,
I didn't realized how using gemframebuffer is really an interesting approach, in fact there is no need to move textures with glsl because it's possible move objects rendered into the framebuffer, also the flipping problem isn't occuring anymore... The solution you are proposing here gives results I haven't expected, and might fit some other purposes that might come later, since the texture processed by glsl (tex0) isn't anymore mapped with mixed textures (tex1 and tex2)... In all cases thank you for the contribution that gave me all the solutions I need in the project I'm working on.
Colet Patrice
----- Mail original -----
De: "Jack" jack@rybn.org À: "Patrice Colet" colet.patrice@free.fr Cc: "PD List" pd-list@iem.at Envoyé: Mercredi 10 Avril 2013 17:13:07 Objet: Re: [PD] flip image in glsl
Le 10/04/2013 07:48, Patrice Colet a écrit :
Hi Jack,
the fragment code is now very short and much more elegant, certainly faster than using conditions, I guess this is due to [pix_info] that is computing dimensions of the resulting texture. This procedure seems to work for horizontal flipping then corrects strange behavior between pix_image and glsl, but vertical flipping has no consequence. It's also possible to crop using the dimen parameter, but I believe there is a zoom parameter missing to do it entirely. So I'm going to restart coding a fragment code from the basis you propose that would allow to crop both textures, because this looks fundamental for my possible use of this object, that is mainly about mixing two textures which coordinates could be modulated to fit a particular context, where textures would need to be placed accurately without having to modify it in an image editor, maybe you have an idea about how to do it simply?
You can do operations directly on vec2 instead of two floats in your fragment shader. You can also avoid condition (could be slow). See patch and glsl vertex and fragment attached for flip. ++
Jack
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->open http://lists.puredata.info/listinfo/pd-list
Hello Patrice,
Not sure to understand what you mean about the problem on horizontal/vertical flipping. Here a new patch and the fragment shader. This time, all is computed from the Gem window size. You can flip, scale and move each texture. (the flip is done from the center position of the Gemwin). In this patch, i use a workaround to avoid to see the 'border' of the texture thanks to the message [perspec( on [gemframebuffer]. I don't know if there is a better solution ? Hope it will help. ++
Jack
PS : I can clean the this patch and keep only the part about position and scale of a texture with GLSL for Gem example if it is interesting ?