Send jit.gl.sketch, jit.gl.text2d to Syphon?
I'm a bit confused as to the most efficient way of using sketch and text2d with syphon.
I can draw to the screen fine but how do I get the results to the Syphon Server?
If I convert to a matrix then presumably this goes from Opengl to cpu and back.
Not sure how to get a texture output which I can feed into the Syphon Server.
I'm sure its basic stuff but I cant suss it out,
Any ideas?
Syphon Server needs a 'texture' to be input. So what you need to do is "render to texture" in Jitter. In Jitter land, there are two techniques to do this. One is @capture, where you specify an existing named jit.gl.texture object you own as another "OB3D" rendering objects @capture attribute.
So.
jit.gl.texture mycontext @name foo
jit.gl.sketch mycontext @capture foo
Now, the jit.gl.sketch will not show up on screen. It renders off screen into the texture named foo. Then bang and send that to Syphon Server.
The "issue" with @capture is it works only on a per object basis. How to capture an entire scene? The solution is to use @capture with jit.gl.sketch, and use jit.gl.sketches drawobject (If memory serves) capablity, coupled with @automatic 0 for the things you want in your scene.
So, in this case, you would have
a context and window named mycontext
jit.gl.texture mycontext @name foo
jit.gl.sketch mycontext @capture foo
jit.gl.text2d mycontext @automatic 0 @name text
jit.gl.syphonserver mycontext @servername capturedemo
Now, sketch draws to the texture, the the texture goes to syphon, and you tell sketch to manually draw the text2d named "text". Search the forum for examples, I have posted some as have many others.
This is from memory, some specifics may be different.
Thanks for the pointers - I'm still a bit confused by all of this tbh. I had a go with @capture but got confused by layers.
Then I cobbled this together from a few clippings I found.
It uses the to_texture method - is this a suitable way of achieving it?