ofxFFGL addon and OpenFrameworks 080

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
davidemania
Is taking Resolume on a second date
Posts: 16
Joined: Sat Dec 21, 2013 15:10

ofxFFGL addon and OpenFrameworks 080

Post by davidemania » Sat Dec 21, 2013 16:52

Hi everybody,
I got a request from a friend to write a few video effects for his Resolume Arena VJ, and a little research showed me that the best option would be to use openFrameworks and ofxFFGLplugin addon. I managed to build a working effect with Xcode3 and OF 620, and now I'd like to make it work with the last library and IDE versions.

A few touch-ups to the plugin code and to the project settings led to a successful compile and link with XCode 5.0.2 and OF 080 on a Mavericks iMac. There still are lots of warnings from deprecated function calls but that should be acceptable. Anyway the final bundle is not recognized by Arena, it does not even appear in the effects list. The bundle structure is fine because if I substitute the executable inside it with another one (from my plugin compiled with the old version for example) it works.

Any hint about how the problem could be fixed? Is there a way to debug it someway? I was thinking about writing debug info to a file since there is no console available, but that doesn't feel like the best idea.

Here you can have a peek to the addon code and to my project directory.
http://www.cogitamus.it/varie/ffglEffectTest.zip
http://www.cogitamus.it/varie/ofxFFGLPlugin.zip

thanks to anybody willing to help!
Davide

davidemania
Is taking Resolume on a second date
Posts: 16
Joined: Sat Dec 21, 2013 15:10

Re: ofxFFGL addon and OpenFrameworks 080

Post by davidemania » Sat Dec 21, 2013 19:40

Looking at the console output for Arena it seems that my plugin is being loaded 3 times, the first 2 with a a "load succeeded" message, the third with a "load failed". Other plugins are loaded 3 times, all of them successfully.

I'm uploading a copy of the log if it can be of any help

Davide
Arena411 console.zip
(8.31 KiB) Downloaded 251 times

davidemania
Is taking Resolume on a second date
Posts: 16
Joined: Sat Dec 21, 2013 15:10

Re: ofxFFGL addon and OpenFrameworks 080

Post by davidemania » Mon Dec 23, 2013 11:35

OK now it loads, I had to change a parameter in the post-build phase (from @executable_path to @loader path) to make it start. At present time it makes Arena crash, but that can be sorted out (at least I hope) :D

davidemania
Is taking Resolume on a second date
Posts: 16
Joined: Sat Dec 21, 2013 15:10

Re: ofxFFGL addon and OpenFrameworks 080

Post by davidemania » Fri Jan 03, 2014 11:12

After a few days spent studying the ideas behind the host/plugin mechanism, FFGL and open frameworks I came to something that is usable (at least for now, but it is true I did not push it very far).

I had severe problems (with crashes) when trying to use multiple copies of the same effect in host. To cope with this unfortunately I had to rewrite important portions of the code. Now the plugin no longer uses an OF app to run but everything lives in the ofxFFGLPlugin class (I had to because ofApp uses globals and it is impossible to run multiple indipendent instances of it at the same time), and the window has been changed to ofAppNoWindow.

The code in FFGL.cpp that was managing the interface with host needed changes too, since it was using globals. A drawback is that the plugin object gets created and destroyed many times when host asks for parameters, but this should not be too bad a problem since it happens only at startup.

I had a weird issue with plugin parameter names, they appeared scrambled in host. My guess is it keeps the pointer to a previous version of the plugin that gets corrupted when it is destroyed and rebuilt. Would be better if host copied the actual string and not only the pointer, anyway I coped with this creating a static object to keep the parameters names (they are identical for all instances). Good luck values seem to work correctly.

The actual drawing and OpenGL seems to work well enough (let alone that damn drawBitmapString that apparently does nothing), but I do not have yet the experience to fully test it. I successfully tried drawing textures from webcam and files, true type text, primitives like lines and rectangles, and using FBOs but that's it.

If someone wants to give it a try here it is possible to get a copy of my project folder. Please notice that this is experimental work with no guarantee whatsoever (I'm not even sure that the original license for ofxFFGLPlugin permits modifications and derivative work, if will turn out to be the case I will remove the file)

http://www.cogitamus.it/varie/FFGL_Exam ... fiedDM.zip

Joris
Doesn't Know Jack about VJ'ing or Software Development and Mostly Just Gets Coffee for Everyone
Posts: 5180
Joined: Fri May 22, 2009 11:38

Re: ofxFFGL addon and OpenFrameworks 080

Post by Joris » Mon Jan 13, 2014 15:14

The ofxFFGL addon was a bit of a after hours project from one of our devs. We love oF but we currently don't really have the time to maintain it.

It looks like you took it and made it a lot better though. The original addon project is open source, so feel free to take it to GitHub and make your own fork.

Would be great to see a working version for 080 and some new oF wizardry.

davidemania
Is taking Resolume on a second date
Posts: 16
Joined: Sat Dec 21, 2013 15:10

Re: ofxFFGL addon and OpenFrameworks 080

Post by davidemania » Fri Jan 31, 2014 10:08

I improved a little my previous modifications of ofxFFGL (aimed to make it work wit OF 080), getting rid of the ugly "testApp" class (it is not ugly by itself but my way of using it was). Now there is one single class (pluginApp) that inherits from the original plugin and everything lives in there.

There is a hook that lets you do something when parameters change (pluginApp::onParameterChanged) and support for shaders, either to be loaded from source files on disk on runtime or embedded in code (see shaders.h).

The project is for XCode 5, and it has a post-build script that copies support files in the build "data" directory and then the whole bundle to Arena vfx dir, to speed up the build-test-debug cycle. There is a little OSX-only code at the setup() method, it is used to gather the complete path of the bundle when loaded by host and load support files (only a sample font in this example).

It should work on windows too with a few minor modifications, it would be interesting if someone wanted to give it a try.

The whole thing is a bit of a hack, and may be it should be reviewed from ground up... but I lack both the time and the knowledge to do it properly, so this is what I can offer. Use it at your risk ;)

At the moment there is not a github fork for this code, but you can easily download it here

http://www.cogitamus.it/varie/FFGL_Exam ... fiedDM.zip

the ofxFFGLPlugin folder has to be copied in "addons" directory in the OF installation, the FFGL_Example_modifiedDM (that you of course can rename at your wish) goes into "myApps".

I successfully used this to build 4 plugins plus the included example, and would be happy to know that someone else is trying and may be improving it (there still is much to do :D )

hive8
Is seriously in love with Resolume. Met the parents and everything
Posts: 320
Joined: Sat Jan 22, 2011 22:42
Location: Los Angeles

Re: ofxFFGL addon and OpenFrameworks 080

Post by hive8 » Tue Feb 04, 2014 00:52

I will give this a try in the coming days on windows, i finally have my machine back in working order. What plugins did you make?
HIVE 8 | Quantum Laser | http://www.hive8.com

davidemania
Is taking Resolume on a second date
Posts: 16
Joined: Sat Dec 21, 2013 15:10

Re: ofxFFGL addon and OpenFrameworks 080

Post by davidemania » Tue Feb 04, 2014 09:52

OK, to make it work with windows you should modify the osx-only code at the beginning of setup() method, it is short and its purpouse is to change the current dir to the plugin data folder (in order to be able to load something from there if you need that, like the sample font).

You should also add steps in your IDE to automatically create the data folder and put the sample font inside it (or delete further references to that if you don't need it). On OSX there is a bundle holding everything together, I do not know how the plugins are organized in windows.

I made some plugins for a friend that needs them for a professional work he is doing, so I'm afraid that I cannot say what they do, at least not before he's going to actually use them, or I'll spoil his show.

I'm still learning (and have a long way to go) so I believe my plugins are not something to be too proud of :D

Post Reply