I have an opengl application written in Java/jogl (the language does not matter for this question).
I’m using instance rendering, buffer objects, vertex and fragment shaders.
The program receives a few float parameters via OSC that are injected as uniforms inside the shaders.
I wish to port my code to touchdesigner so I can easily add composting with the output of my opengl program. (ie. Add blur or feedback without developing further layers of opengl programs).
80% of the code is Glsl and the rest is Java code calling opengl C functions.
I am willing to recode the Java part in any language.
Could someone tell if it’s possible to port that application inside touchdesigner? If yes, could you point to the right documentation? I tried a few keywords but didn’t find what I was looking for.
I found how to receive OSC values which is a good start. I also found how to program fragment shaders, but it’s not sufficient.
If it’s not possible, is there any hack / workaround to capture the opengl buffers of my Java program so that it is processed by touchdesigner?
Hey, Welcome!
There isn’t specific docs on porting from OpenGL. However for your GLSL you’ll want to use the GLSL TOP and GLSL MATs. You don’t really have to think about buffer objects since those are all handled for you.
From your Java program, look into Spout and DirectX texture sharing. That is how you can get textures across processes in Windows. Or Syphon on macOS.
This is memory that is readable and writable and that you can use for example to update particle positions, using instanceId, at each frame using the GPU. This is to avoid computing them on the CPU and transferring them to the GPU memory.
You would just write to textures for that in the GLSL TOP. Then you can source those textures as your particle positions in a GLSL MAT. The gpuParticles example in the palette does this.
Is there absolutely no way to use Buffer Objects? They are much more convenient for generic memory.
I have something like 10 attributes per instance. Using structs and buffer objects is very convenient. Textures are really not convenient and will make the code harder to maintain.