← Back

ofxImageSequenceRenderer

github.com/bensnell/ofxImageSequenceRenderer · @bensnell
OF 0.11 Graphics Video/Camera

Rendering manager for exporting image sequences from keyframed 2D + 3D scenes

0 0 Last commit 4y ago Created 5y ago

README

ofxImageSequenceRenderer

This is a rendering helper for OpenFrameworks that streamlines the process of exporting image sequences of 2D and 3D scenes, in preparation for video compositing. Example usage follows:

Create a class that inherits from ofxImageSequenceRenderer. This class will do all of your personal rendering:

MyRenderer.hpp

``c++

include "ImageSequenceRenderer.hpp"



class MyRenderer : public ImageSequenceRenderer { public: void setupParams(); void setup(); void update(); void keyPressed(ofKeyEventArgs& e); protected: void uRender(ofFbo& uFbo, ofCamera& uCam, float paramLinear, float paramTransf, float scale); private: float myParam; }

MyRenderer.cpp
c++

include "MyRenderer.hpp"



void MyRenderer::setupParams() { // Set the scale of objects of interest (e.g. objects rendered // are approx 1000 units wide): setScale(1000); ofxImageSequenceRenderer::setupParams(); // setup any personal parameters, for example: RUI_NEW_GROUP("MY_PARAMS"); RUI_SHARE_PARAM(myParam, 0, 1); }

void MyRenderer::setup() { ofImageSequenceRenderer::setup(); // setup anything else }

void MyRenderer::update() { ofImageSequenceRenderer::update(); // update anything else }

void MyRenderer::uRender(ofFbo uFbo, ofCamera& uCam, float paramLinear, float paramTransf, float scale) { // This is where all our rendering happens, for example: uFbo.begin(); uCam.begin(); // don't use uCam if rendering a 2D scene ofSetColor(255, myParam, 0); ofDrawBox(-0.5, -0.5, -0.5, 1, 1, 1); uCam.end(); uFbo.end(); }

void MyRenderer::keyPressed(ofKeyEventArgs& e) { ofxImageSequenceRenderer::keyPressed(e); if (e.key == 'a') myParam = (myParam + 10) % 255; }

Then, utilize your class in the application, and use the RUI (ofxRemoteUI GUI) to start and stop application exporting, with the specified length, frame rate, resolution, and etc.

ofApp.h
c++

include "MyRenderer.hpp"



class ofApp : public ofBaseApp { public: void setup(); void update(); void draw(); MyRenderer renderer; }

ofApp.cpp*
c++

include "ofApp.hpp"



void ofApp::setup() { renderer.setup(); }

void ofApp::update() { renderer.update(); }

void ofApp::draw() { // First render imagery to fbo renderer.render(); // Then, draw it for debugging purposes (if so desired) renderer.draw(0, 0, ofGetWidth(), ofGetHeight(), true); }
``

Get this addon

HTTPS
SSH