Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

GLSL texture feedback (in&out) and windowing for brush

$
0
0
Hello,

I would like to know what is the most effective way how to use glsl shader in processing 2.0 to do operations on texture (image processing) without copying the data back and forth between RAM and GPU memory. 

for example this GLSL shader using WebGL is doing fluid simulation as texture processing
http://webglplayground.net/?share=Nk1CmYGN38
Is it possible to do with GLSL warper of processing 2.0?

If I render the shader into PGraphics  which is at the same time bind as input texture for the shader, does it copy the image back and forth between GPU and RAM? And if not, is there any problem with synchronization? I mean that part of texture is already updated and part is not? If so, it can be solved probably by swapping two buffers  - I mean first bind buff1 and render to buff2, than bind buff2 and render to buff1. In this case - does it copy texture back and forth in each swap, or does it stay on GPU and move around just pointers?

--------------------- Question 2 -------------------

Is it possible to apply glsl filter just on some part of the texture (windowing)? Let's say just in some radius around mouse pointer?

Is the way shown in 
processing-2.0\modes\java\examples\Topics\Shaders\ImageMask\
the most effective way? Does it copy the whole image between GPU and CPU in each frame? 

I was thinking about tiling the image into several smaller parts (let say 256x256 pixels) but it would make the algorithm much more complicated especially when the mouse pointer is near the edge of tiles. So I hope it is not necessary fr speed.

-------------- Background ---------------------

I'm most interested in making a procedural fractal painting "brush" using GLSL, which process current state of image and render the result into the same image which is displayed on the sceen as "the painting". I wan't it to be fast because the processing algorithm or the fractal brush could be quite computationally demanding and I also wan't the painting to be stored internaly in much bigger resulution than the screen (~ 4000 x 2000 pixels )   

Viewing all articles
Browse latest Browse all 1768

Trending Articles