View of ofmesh to ofimage



For a project I have to create an ofimage with a view of my ofmesh. I use ofeasycam for watching the mesh.
Is there anyway to do that ?

Sorry for my english!


So you just want to create an image from the mesh that is displayed in the OF window?

You could just use grabScreen(); and specify the area to save as an ofImage.

Then you can save the image to your data folder or just keep the grabScreen area stored in the ofImage.


Thx for the answer. It gave me something strange like keeping every frame in the ofimage but I have done img.clear(); and img.update(); .And I have to display this ofImage in real time.


ha! that´s a cool glitch though! You need to clear on each call. I’m not sure, but try setting the background color each time you call grab screen. if that doesn´t work call instead ofClear(0, 255) or whichever color you want to use to clear. if all fails, just draw a black rectangle as the background, that covers all the screen.
hope this helps.
Another option is using an ofFbo. it does pretty much the same internally than grabScreen, but allows you more control over the size of the screen. check the fbo examples and search the forum, there´s a lot about it. best!


Thanks a lot !!! The idee of the ofrectangle works perfectly!
It’s works fine now!