Creating a second windowwith OFxfenster and having a video play on it

Im playing around with ofxfenster to create a second window and display a video on it. Can anyone exaplain how exactly creating a new window works. I have looked through the examples but am failing to understand as the new windows dont include an update method.

any help will be appreciated.

I think the same code is executed for each window. When I wanted to show something only on the second screen I had to check in draw() which was the current screen.

I use an FBO as drawing canvas for the second window.
During initialisation, I set the pointer to the second window fbo, and during testApp::update() I draw into the fbo. The draw method of the second window gets called automatically, but i overwrite it to just draw the fbo.
This is the code i use in several sketches, hope it helps you


#pragma once  
#include "ofMain.h"  
#include "ofxFensterManager.h"  
#include "ofxOpenCv.h"  
class SecondWindow: public ofxFensterListener {  
	void draw();	   
	void setHandle(ofxFenster* _win);  
	void toggleFullScreen();  
	void setFbo(ofFbo* _fbo);  
	ofxFenster* win;  
	ofFbo* fbo;  

The cpp file:

#include "SecondWindow.h"  
SecondWindow::SecondWindow() {	  
	fbo = NULL;  
void SecondWindow::setFbo(ofFbo* _fbo) {  
	fbo = _fbo;  
void SecondWindow::draw(){  
	if (fbo != NULL) fbo->draw(0,0);  
void SecondWindow::setHandle(ofxFenster* _win) {  
	win = _win;  
void SecondWindow::toggleFullScreen() {		  

in my testApp.h I have declared:

		void setupSecondWindow();  
		SecondWindow secondWindow;  
		ofFbo secondWindowFbo;  

and in the testApp.cpp file:

void testApp::setup()   
       //define the world: same as the projector screen  
	ofRectangle world = ofRectangle(0,0,1024,768);  
        //setup the fbo  
        //setup the second window class  
        //this creates the actual window, and couples it with my secondwindow class  
	ofxFenster* win = ofxFensterManager::get()->createFenster(world.getWidth(),world.getHeight());  
        //finish by configuering  
	win->setWindowTitle("Projector Window");  
	secondWindow.setHandle(win); //for going fullscreen later on  
	secondWindow.setFbo(&secondWindowFbo); //to-be-drawn content  
void testApp::draw()   
         //draw whatever you want in the secondwindow  

I slightly understand whats your saying. But when playing a video file where would i call the update method? Just before i call it in the draw method?

in your testapp::update() method you do video.update();
then in the testApp::draw() method like above, you do:

void testApp::draw()     
         //draw whatever you want in the secondwindow    

Thanks. Im going to try that now.

I ve set up a blank document like this and am getting errors. What am i doing wrong?

probably you didn’t setup the addon correctly. Do the examples work?

Also, you defined some variables outside the scope of testApp. Start from a working fenster example: get those running as they are provided, once you got that proceed by editing…

Okay ive created a project using the project generator with the ofxFenster addon. I have then copied the code from one of the examples (and the data included in /bin) into the project i created. I get these errors when i try to run it. I take it that this is not set up correctly? How do i go about setting it up correctly.

there is a ready to run xcode project in the “example” directory of ofxFenster. try that…

The code in the example folder works. However if i copy it to myApps folder it doesnt work. Do i need to do something if i change move it?

I have tried to use the project generator to create an ofxfenster addon programme and then copy the code from the example in here and it still doesn’t work.

any suggestions?

Hi. You are missing the .a files for OS X are you sure you have included them in the project? Those:

Also I think the Xcode sometimes has problem when there are multiple a fiels with the same name referenced. So maybe double check if those are nowhere in your project:

Then you shoud be able to just drag and drop the a files. Or do it according to this:

I had the same issue. See here for info on what got it working for me.