How to draw in two layers


#1

Hi all,
I want to implement two effects at the same time, the first effect need to clear the background every frame,but the second effect don’t need to clear background, so there is collision here. How can I solve this problem? Can I draw in different layers in Openframeworks? Thank you!


#2

hello,

you need to use FBOs. They are containers for textures where you can draw any content. then you can draw the FBO on screen.

draw each effect into different FBOs.
Mind that basically FBO is not cleared each frame so call ofClear() to clear it if needed

http://openframeworks.cc/documentation/gl/ofFbo/