I translated a few examples provided by openFrameworks so that they work in TouchDesigner, namely shader/04_simpleTexture, shader/08_displacementMap, and math/particlesExample.
In the provided examples an ofAppNoWindow is used to prevent openFrameworks from creating an OpenGL context (we want to use TouchDesigner’s). However the problem is that ofAppNoWindow creates an ofNoopRenderer which as the name would imply, doesn’t actually do any rendering. This means that any draw calls (or similar) will either crash or do nothing because those functions are querying for a renderer that is missing some crucial functionality.
Basically any image or shader draw (and other) functions act as an interface to the renderer. Because the ofNoopRenderer isn’t particularly useful, the function calls must be more explicit; skip the shader/image (or whatever) function calls, and just call the renderer functions directly. Some additional setup is required that is illustrated in the examples, such as glewInit().
Download the attached zip and put the examples into apps/myApps in your installed openFrameworks. The .sln is setup to build .dll’s at the moment, and they can be found in /bin. Open the .sln file and build and you should see the .dll there. When you run the .toe of the example, simply import the appropriate .dll.
A couple more things to note: openFrameworks by default looks for the /data directory in the same directory as the executable, which in this case is the installed TouchDesigner. You can get around having to put the /data directory in your installed TouchDesigner by using ofSetDataPathRoot(relative_path_to_new_dir) to set the new directory containing your /data. relative_path_to_new_dir will be the relative path from the TouchDesigner executable to your new directory. In addition, your openFrameworks and TouchDesigner should be located on the same drive because openFrameworks is not capable of setting new path roots across drives.
If you have any issues getting the examples working let me know, and hopefully this is enough to get you started! I’ll be working on updating the wiki with this, and any additional information.
Examples can be found on the wiki:
derivative.ca/wiki088/index. … Frameworks
EDIT: Modified the example to error on compile, just so it’s apparent after download that the new path needs to be set with ofSetDataPathRoot().