ofxFenster addon to handle multiple windows (rewrite)

Hi, a while ago I released ofxFenster, an addon to handle a second window. It worked alright but had only limited support, no opengl sharing and only one additional window. Now with our current project, we needed something a little more flexible and I decided to share the code, which is still a work in progress.

So I’ve started with a complete rewrite and abandoned the not so flexible glut. The new ofxFenster uses GHOST, the underlying window manager of blender. I looked at a lot of libraries and found that one the most promising. It has a clean API, cross platform support, a lot of features and should be maintained since it is a part of blender.

The library only works with the of 0.07 release. If you use 0.06 check out the old version of ofxFenster: http://forum.openframeworks.cc/t/ofxfenster—addon-to-handle-a-second-window-[outdated]/3916/0

[EDIT] On mac it’s working now and windows version compiles but has some issues…

Download the library and example here: https://github.com/underdoeg/ofxFenster

Attached is a screenshot of the example.

As soon as I have more time, I’ll try to document more and do bugfixes. Please test, comment or contribute :slight_smile:

Recent version should work with mac as well. But there is an issue with y coordinates in the example. Looks like y is upside down or something…

will it working on windows?

Yes it should. It’s build on top of blenders window manager so it theoretically works wherever blender does. If anybody wants to give it a try, I attached the windows specific code. Just put the windows folder in the libs/src folder and compile. I’ll include these files in the release as well as soon as it’s ready…


nice,thank you,have to try this!


But everybody beware! I’m sure it still has a lot of flaws. So it’s probably not the best choice if you’re on a tight schedule and need something that just works out of the box. But please try and report bugs. I’ll try to fix ASAP…

Actually, I think it is much better now. Not perfect but ready for a testdrive…

Somehow I can’t edit my first post…

Just wanted to inform that we moved to github. So the latest version is here: https://github.com/underdoeg/ofxFenster

Were you trying the pencil icon? I had issues with that but Modify (at the top of the post) seems more reliable.

Thanks, you were right. that just worked…

This works pretty well, thank you for releasing.
The y mouse coords on the fenster window appears to be off by about 25 pixels for some reason?
I am on a mac, and the separate ofxFenster window does not work on my external screen, but works just great on my laptop screen.
Any suggestions?


Yes, I know that there are some problems with the mouse cursor. I’m working on it. It has something to do with the window borders and top bar not taken in account or so… For now, it’s probably best to just subtract the 25 pixels, until the fix works reliably. It is my top priority, so it shouldn’t be too long.

I haven’t tried the addon on a second screen with mac yet. But I’ll try it as soon as I get the time. (tomorrow, I hope) What did not work in your case? What did you try it with? A macbook?

Thanks for looking into this. Yeah, I subtracted the ~25 pixels and it worked.

I have a control panel in one fenster window (not the primary window) and rendering the visuals to the primary fenster window. I am on a macbook pro with an external screen attached. When I drag the control panel window onto the external screen, I can no longer receive mouse events in the correct location. I have not checked if I am in fact receiving the mouse events. When I keep the control panel on my laptop screen and the render window on the external screen, it works great. I have not tested if I get correct mouse events on the render window on the external screen. I know in many occasions the control panel will be on the laptop screen, but just wanted to address the issue.

It is pretty solid and works awesome! It is great to have the control panel in a separate window. :slight_smile:

Thanks again.

out of interest: what did you implement the control panel in (GUI wise)?

I used Theo’s ofxControlPanel

good to hear it worked with ofxControlPanel. Did you have to manually register the mouse events or something. I was concerned that maybe gui addons may rely to much on the automatic event registrations and such and didn’t provide the flexibility to hook them up with a specific window out of the box?

I looked at the mouse problem again and cross checked with the blender source code. Looks like I found something that may work & updated the code on github. Please give it a try and tell me if that works for you?

For now I tested the example with OS X and an external screen and all behaved ok. Will check windows 7 and linux in the evening.

[EDIT] just tried the fix with linux and windows and the mouse cursor position seems to be allright. phew finally…

Nice!!! Just tested the mouse position and it worked great on both my laptop screen and the external screen.

I like ofxControlPanel since it does not automatically hook into mouse events. That way if it is hidden, I just don’t pass mouse events so they don’t trigger if it is not being drawn. I did have to pass a reference to the main window from the control panel window so that I could grab key events from both windows in the main one.

void GuiWindow::keyPressed(int key, ofxFenster* win) {  
void GuiWindow::keyReleased(int key, ofxFenster* win) {  

In the gui window, I handle all of the mouse events for the control panel

void GuiWindow::mouseDragged(int x, int y, int button, ofxFenster* win) {  
	gui->mouseDragged(x, y, button);  
void GuiWindow::mousePressed(int x, int y, int button, ofxFenster* win) {  
	gui->mousePressed(x, y, button);  
void GuiWindow::mouseReleased(int x, int y, int button, ofxFenster* win) {  

Hi Nick,

Great work on the addon!

However I’m getting unresolved errors from the ghost library, can you please tell me where to find this library?


Hi, what system are you on and what kind of errors do you get?

You can download the modified ghost sources over here: https://github.com/underdoeg/ghost

First of all, nice work, Nick! I really need this functionality.

I’m having trouble getting the example to work though.
I’m using VS (I’m “forced” to do so) and missing the static library. If I compile it on my own using the ghost source from the blender site and add it to my project. I get linker errors saying that about a hundred funktions are already defined in the msvcp100.dll. I guess you changed the original ghost filed.

Could anyone please help me? I’m lost


Yes, I changed the original ghost files. You can find the modified version here: https://github.com/underdoeg/ghost I never compiled it for VS, so I don’t know if it should work out of the box. But it might not, I don’t think I changed anything crucial but I had some troubles getting it to compile with Code::Blocks. So if you run into any problems you can’t resolve, please post them here. Because having a VS compiled lib is beginning to be on the Todo list.