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

Porting GLGraphics Bloom example to Processing 2.0b0.7

$
0
0
Hi!

While I've started reading on GLSL again (third try, maybe this time it'll stick :) ), I do not yet know how it works internally...

For many of my sketches, I just used the beautiful bloom effect from the GLGraphics examples, and now I'm looking to port that to Processing 2.0.

While I've found one to one mappings between a lot of the old and new code, there's two calls that confuse me as to how I should re-write them for b0.7; the apply and filter calls in the snippet below:

  1. // Extracting the bright regions from input texture.
            extractBloom.set("bright_threshold", fx);
            extractBloom.apply(glg1, tex0);

            // Downsampling with blur.
            tex0.filter(blur, tex2);
            tex2.filter(blur, tex4);
            tex4.filter(blur, tex8);
            tex8.filter(blur, tex16);

            // Blending downsampled textures.
            blend4.apply(    new PGraphics[] { tex2, tex4, tex8, tex16 },
                            new PGraphics[] { bloomMask });

            // Final tone mapping into destination texture.
            toneMap.set("exposure", fy);
            toneMap.set("bright", fx);
           
            toneMap.apply(    new PGraphics[] { glg1, bloomMask },
                            new PGraphics[] { destTex });
Note I've here optimistically assumed that PGraphics can stand in for the old GLGraphics GLTexture class, and that PShader can straight-up replace the old GLTextureFilter :)

Seeing that low-lever OpenGL and GLSL is being revamped as we speak for the next release, maybe I'm asking too early... but if there are counterparts to the above calls for P 2.0b0.7 I'd sure love to know about them!

...Now off to reading about GLSL in my new book :D

Thanks!

Viewing all articles
Browse latest Browse all 1768

Trending Articles