ofxSyphon openGL > 2.1

Hi,

As far as I could read in forum of Syphon’s web site, ofxSyphon do not support openGL version higher than 2.1. There were attempts to make it work for 3.1 (and I wish it could work 3.3) in 2014 on github, the problem is that the software that receives sould also have those updates in order to work.
So the question is : Is there anybody who could make syphon work with openGL 3, make a shader, and receive the texture in an other app ?

Thanks

Nico

The ofxSyphon itself can work with opengl 3.2, but the syphon.framework itself is compiled for opengl 2.1. This issue in the framework github has links to some forks that supports modern OpenGL
https://github.com/Syphon/Syphon-Framework/issues/13

You only need to compile the framework and replace the one that comes with the addon. A word of caution, not all the Syphon receivers can handle those textures. I had good experiences receiving in madmaper and not working with resolume a few months later.

In my case I use maxMSP in combination with OF, and as I’m not an expert in manipulating frameworks without corrupting everything. I don’t want to take too many risks. I’ll have a look at these updates when I feel I have time and motivation for.

Thanks

It can be done: https://goo.gl/Nhvnwa

It’s like a hack… I’m usually using it on a programmable renderer.
you add to ofxsypthonserver.mm.

void ofxSyphonServer::publishFBO(ofFbo* inputFbo){
    // If we are setup, and our input texture
    if(inputFbo->isAllocated())
    {
        NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

        if (!mSyphon)
        {
            mSyphon = [[SyphonServer alloc] initWithName:@"Untitled" context:CGLGetCurrentContext() options:nil];
        }
        SyphonServer *ss = static_cast<SyphonServer*>(mSyphon);
        CGLLockContext(ss.context);
        CGLSetCurrentContext(ss.context);
        NSSize size;
        size.width = inputFbo->getWidth();
        size.height = inputFbo->getHeight();
        [ss bindToDrawFrameOfSize:size];
        GLint syFBO;
        glGetIntegerv(GL_FRAMEBUFFER_BINDING, &syFBO);
        glBindFramebuffer(GL_READ_FRAMEBUFFER, inputFbo->getFbo());
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, syFBO);

        glBlitFramebuffer(0, 0, size.width, size.height,
                          0, 0, size.width, size.height,
                          GL_COLOR_BUFFER_BIT, GL_LINEAR);
        [ss unbindAndPublish];
        CGLUnlockContext(ss.context);

        [pool drain];
    }
    else
    {
        cout<<"ofxSyphonServer FBO is not properly backed.  Cannot draw.\n";
    }
}

Minimum Usage

ofFbo fbo;

void setup()
{
    fbo.allocate(ofGetWidth(), ofGEtHeight());
    fbo.getTexture().getTextureData().bFlipTexture = true;
}


void draw()
{
    fbo.begin();
    ofClear(0);
    //draw some.....
    fbo.end();

    fbo.draw(0, 0);

    mainOutputSyphonServer.publishFBO(&fbo);
}

I also usually use the programmable renderer. The solution from @yuma_taesu worked perfectly on my machine.

Thanks!

For info, there is a recent update in ofxSython that makes it compatble with other versions of GL.
I tested the following :
kodeLife(gl 4.1) to OF (gl 3.3)
MaxMsp(2.1) to OF(3.3)
and OF to Max.

All worked without any need to change some lines of code :slight_smile: