I needed to get something that would grab pixels below the OF app (ie, screen grab) for a student. this is my first attempt which wraps some cocoa code for that…
here’s a shot of it in action (showing the pixels directly below the OF app window in a texture):
I’ve uploaded the app - but to compile this code, you’ll need to compile for 10.5 and also, add the appkit framework.
the code is pretty simple. the .h file (with corresponding .m) exposes this function:
unsigned char * pixelsBelowWindow(int x, int y, int w, int h);
that returns BGRA array of pixels in the rectangle x,y,w,h. I manually convert that to RGBA for opengl uploading, but you can do what ever you want with those pixels – process them, manipulate them, etc.
I’ve noticed it work pretty well in some cases (ie, live updating in realtime on top of quicktime videos, etc), and flickers sometimes with things like youtube videos (which might be blitted to the screen in a different way?). give it a try and let me know. Also, it’s not thoroughly tested so it might be radically inefficient.
I think his plan is to process live video from skype but not sure what the final outcome will be. the idea is to open up the skype video window and have the OF app running fullscreen on top… - z
tried some of the screen capturing addons but none of them worked for me, found this discussion which and it worked for me, so i’ve packaged it up into a new addon: https://github.com/genekogan/ofxScreenGrab
I tried the ofxScreenGrab addon and it worked but not with multiple desktop with Mission Control, the app just crash I think because it tried to access memory not allocated to it which points to something offscreen.
Hey! I know this is an old post, and not sure if this is relevant, but if you want to just take a screenshot across multiple desktop screens, you can call the terminal from OF with system. No matter what desktop you are in, it will take a screenshot. For example, when I smile I want OF to take a photo of my screen no matter which screen i’m on, and it works! Thanks Zach Lieberman for the suggestion!