Introducing ofxDarkKnight: flow based programming for OF


#1

Hello OF developers!

I’ve been working on a flow based programming environment designed for audiovisual performances. I started this project before the OF 0.10 was released, so this is based in OF 0.9.8.

The motivation for this project is to have the ability to perform with my OF sketches. My focus is to create VJ’ing and projection mapping graphics with this. I already perform two times with it in public competitions.

The addon includes 5 basic modules:

  • Sketch Pool: integrates drawing sketches and the ability to change between each other in real time.
  • 2 graphics modules: classic constellation & classic terrain examples.
  • Preview: shows the output of the sketch pool.
  • Screen output: renders the output into an external screen.

I’ve already created a lot of modules with this addon including:

  • MIDI controller
  • OSC controller
  • Syphon input/output
  • Audio analysis
  • Ableton link
  • Projection mapping adjustment
  • NDI
  • A lot of graphics modules.

None of those modules are included in the addon, I will release those in separated addons.

Of course it has some problems but I hope you find it useful. Let me know if you have any questions, I’ll try to make a good documentation that shows you how to create your own modules. But if you look into the graphics modules you will see how to do it.

Here’s an example of an implementation of the addon in my own app:

Greetings from Mexico


#2

Wow! looks neat.

Can you tell us a bit more about how the nodes I/Os and wires are implemented and how could we use it to control arbitrary parameters in our own sketches?
I read that you are writing the docs, but just a vague description to get the idea.

great job!


#3

Thanks @daylankifky,

There’re two types of modules, “stand alone modules”, something you need to create like a MIDI controller, a Shader FX or a Syphon server. And there are “graphics modules” this are your sketches that you want to include in the media pool and switch between each other during your performance. Both of them should extend the Module class but the first ones are added directly to the manager and the second ones are added to a collection that will be displayed in your sketch pool.

For now it can handle only two types of connections: floating point values and fbo’s. When you create your own module you need to implement some methods: setup, update, draw, addModuleParameters, and few others.

To add your parameters you need to have a property in your class, let’s say int numParticles. Then you need to add a slider in the addModuleParameters function just like you normally do it in ofxDatGui and bind it to your property. My fork of ofxDatGui is implementing the WireConnection class, so every parameter creates an instance of it and creates this connection.

Everytime you create a “cable” between parameters it creates an instance of Wire class, this has an output connection and an input, you always interact with the input and this modifies the output with the reference that is stored in memory.

It’s all about memory addresses (pointers). For the fbo’s it’s the same, but I call this, mainOutputs or mainInputs, for instance the preview module, in order to draw something you need to pass a mainOutput to it’s input. You can do that in a special method called drawMasterInput or drawMasterOutput. In this method you just specify the color of the connection, the addon handles everything else.

The preview module shows how you can create a stand alone module it’s located in libs/modules/preview. To create a graphics modules take a look at libs/graphics/constellation.hpp. You can create something similar, but to added to the project you need to modify the /libs/collections/basic.hpp and add it to the collection. With this it will appear in your sketch pool and you will be ready to rock. I’ll try to do a video tutorial this same week to show you how to do this. I hope I gave you a big picture of how it works.

Thank you for your interest.


#4

It did give me a big picture, thanks!
I’ll give it a try as soon as I can


#5

I just created a basic documentation for the addon. It explains some basic concepts that will help you create your own modules for the environment.

I also added an example that implements ofxDarkKnightMidi a brand new addon that implements some MIDI functionality and that shows how to implement third party OF addons in the ofxDarkKnight environment.

Cheers.