Is there a way to draw and save fbo() smoothly?

Hi all, I am running and modifying the examples from the main installation OF folder. The examples work and run great.

When I introduce fbo in order to save the graphics to a folder frame by frame, the fbo() makes frames skip. The output is not smooth at all. Is FRAPS (or any other screen recorder) the best way to get the smooth video of the graphics? OR is there some fbo() trick to make it draw and save one frame at a time, even if it takes ages - it’s ok.

thanks

You can try ofxImageSequenceRecorder Or if you are on mac use syphon from your fbo and syphon recorder

1 Like

There are many great and high completeness addons for screen recording, but would you like to check out my simple and humble class for screen recording? :stuck_out_tongue_winking_eye:

It’s easy to implement, just bring this header file into your src and follow the instruction on Github.

Hope this help

1 Like

adding one more addon to the collection of screen recording utilities: https://github.com/arturoc/ofxTextureRecorder. that would only work with the nightly builds though.

but i think what you mean is that since the fbo takes so long to save your animation is not smooth anymore, it skips frames, you don’t mind so much if it takes longer to save as long as the resulting animation is correct, right?

in that case the problem is probably that you are relying on some time function to do your animation which is usually the correct thing to do but when rendering frames can take much longer than they really are so instead of using those time functions you can fake time by storing it on a variable and incrementing it by the real amount of time that passes every frame like:

real time:

float now = ofGetElapsedTimef();

rendering:

//h:
float now = 0;

//update
now += 1. / 60.;

where 60 is the fps of the application when running in real time or of the resulting video

2 Likes

wow thank you guys. Will try them all! ofxImageSequenceRecorder is already working - I am so happy

hi arturo, do I put these in setup or draw? Also, do I need to comment out the existing lines:
float time = ofGetElapsedTimef();
shader.setUniform1f(“time”, time);

it depends on your program and the kind of time calls you are using but for your example you might want to update the time in update and then change every call to ofGetElapsedTimef() with now, so instead of:

float time = ofGetElapsedTimef();
shader.setUniform1f("time", time);

you would have:

in .h:

float t;

in update:

now += 1. / 60.;

in draw

shader.setUniform1f("time", now);

you might want to have an easy way to swap between one way and the other so when/if the app runs in real time (without rendering) the timing is completely accurate

1 Like

it is working very well :slight_smile: will take forever, but my project is due in 5 weeks so have plenty of time.