Using pixels of entire screen

I want to get access to all the pixels that are being drawn to the screen so I can manipulate them. For instance; I’ve got a little animation of a moving cube and want to filter certain colors, or apply a blur to it (not just to the cube but to the entire window).

How can I get access to the pixels in a fast way? I tried uiting grabScreen but grabbing the entire window in each frame is very slow.

I’m not sure what to do since I’m used to Processing in which loadPixels() would get you the pixels, and after editing them you simply call updatePixels() to ‘save’ the changes so you can show them.

I’ve read the OF for Processing users page on the wiki, but the example for editing the pixels of the screen is just this:

ofImage theScreen; //declare variable  
theScreen.grabScreen(0,0,1024,768); //grab at 0,0 a rect of 1024x768. Equivalent to loadPixels();  
//edit pixels in theScreen  
theScreen.draw(0,0); //equivalent to updatePixels();  

I get how I can read the pixel values of an image, but I seem to get lost when I want to edit and display them.

You want to look into FBO’s (Frame Buffer Objects). I would link you to a post but there are several depending on your needs. Do a forum search and you’ll find a lot about them.

Basically they let you draw to an off screen buffer, you can grab teh pixels from this and manipulate them, copy them into a texture or another FBO (ping-pong filtering), etc. then draw them onto the screen