Reply To: little bit unclear

Home Forums Syphon Syphon Implementations – User little bit unclear Reply To: little bit unclear


Hi Karl,

We also have not done much JNI and from what i’ve seen, I’ve not been looking forward to it either, hah! I do want to get a bit more familiar with it, as it seems useful for projects like Alchemy and Processing and the like. Thanks very much for getting in touch.

So, Syphon is implemented in such a way that right now, it assumes the input image is an OpenGL texture (GLuint texID) that will be published to the outside world (this is if you are implementing a server). If you implement a client, it *gives* you a texture. Both Client and Server require a valid working GL context.

You can get a brief overview of our API here:

That said, the API Syphon uses behind the scenes has some hooks we could potentially expose for using pixel buffer style images that do not require a GL Texture to be present for server publishing, however for speed, I think it makes sense to keep things GL most often, since most environments use that for display, or image processing. This has been something we have considered.

If you are using GL to render a full scene, you can make a new texture and do a glCopyTexImage2D to get the contents of the back or front buffer into a texture, and then push that through a syphon server. This is an option in the QC plugin, if you look at the source, thats how we get the ‘scene’ as rendered by QC. The pertinent code is:

However, If you have a pixel buffer, and no GL anywhere in the app, you could right now on the JNI side of things,

Create a new CGLContext (CGLCreateContext and prerequistes)
Make it active (CGLSetCurrentContext or use CGLMacros)
Make a new texture (glTexGen) and populate it with the content of your cpu side memory (glTexImage2D)
tell the server to use it via the SyphonServer publishFrameTexture: method.

Forgive me if you get all this, at least GL wise. Let me know if that was helpful or just confusing as hell!

Alchemy looks really interesting, would be great to get it working, and if possible, with alpha too for nice compositing with other environments and scenes.

Thanks again for your interest!