That's funny, I just did exactly this recently, but in openFrameworks. If you want to do it entirely in GL (which will be fastest), this is how I did it:
start with a white framebuffer and gradually draw black stuff in there. Don't clear the framebuffer so it accumulates. You can even draw with alpha blending to make the decomposition smooth. Then simply use the texture of the framebuffer as the alpha mask for your image texture.
I couldn't see how to do GL alpha masking in GEM but you can easily write a little shader which takes the two textures as uniforms, then you would just need to take one channel of the mask texture and copy it to the alpha channel of your image texture.
You can also try on the CPU level: create your mask in a table, make it to a greyscale image and use pix_takealpha to copy your alpha mask to your image pixels. Of course, this will be much slower.
You can also mix the two approaches: create the mask on the CPU and do actually masking in GL.
Hope that helps!
Gesendet: Samstag, 08. April 2017 um 10:02 Uhr Von: "Roman Haefeli" reduzent@gmail.com An: pd-list pd-list@iem.at Betreff: Re: [PD] [Gem] Modifying single pixel of pix image
On Sam, 2017-04-08 at 08:29 +0200, Christof Ressi wrote:
If it can be on the GPU, use a fragment shader! Do you work with a formula or do you set the alpha values by hand?
By Hand (maybe later by a formula). Is it possible?
The idea is to have two overlaying images. The visible one slowly decomposes over time so that the image behind appears. I thought about setting alpha to for more and more pixels as a way to decompose the front image. Maybe there is another/better way?
Roman
Gesendet: Freitag, 07. April 2017 um 23:39 Uhr Von: "Roman Haefeli" reduzent@gmail.com An: pd-list@lists.iem.at Betreff: [PD] [Gem] Modifying single pixel of pix image
Hi
Is it possible to manipulate a single pixel of a an image loaded by [pix_image]? Specifically, I'd like to change the alpha value of certain pixels. It doesn't matter to me whether the manipulation happens in the pix realm or the GL realm. Currently I can think only of cumbersome ways like using [pix_dump] -> [pix_set] and applying the manipulation to the largish list passed between them. Or by using [pix_pix2sig~] -> [pix_sig2pix~] which is basically the same, but would allow to do the manipulation on a table.
Roman _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/l istinfo/pd-list _______________________________________________
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list