I've rephrased my question to:
It is possible to copy pixels from one canvas/image to another using PixelEffect? If so, how?
The answers seems to be no, you can't alter a texture that was sent to a PixelEffect. I've decided to just copy the pixels with imageData instead.
----------------------------------------------------------------------------------------------------
Quick question, if I have a PixelEffect running on an object, and I pass to it a canvas. Is it possible to alter this Canvas?
So if I have something like:
Code: Select all
extern Image GBuffer;
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords)
{
vec4 pixel = Texel(texture, texture_coords);
vec4 bufferPixel = Texel(GBuffer,texture_coords);
//do some stuff, blah blah, change color of pixel
bufferPixel.rgba = pixel.rgba;
return pixel;
}
This code should copy over the old texture to "GBuffer", but that doesn't seem to happen. In fact it says that the "GBuffer" variable isn't being used. So I'm guessing I'm doing it wrong?