Syphon and Ogre

Home Forums Syphon Syphon Development – Developer Syphon and Ogre

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #14202
    tony
    Participant

    Hi everyone !

    Is anybody using syphon in an Ogre3D app ?

     

    My app embeds a syphon server. And I have some troubles pushing frames to it.

    Using simple client, I can connect to my embeded server, texture resolution and framerate are ok, but texture is garbage.

     

     

    Here is how I create server:

     

    Ogre::RenderWindow* videoOutput = videoOutputs[VIDEO_OUTPUT_PREVIEW];

    Ogre::OSXCocoaWindow* videoOutputCocoa = static_cast<Ogre::OSXCocoaWindow*>(videoOutput);

    NSOpenGLContext* mGLContext = videoOutputCocoa->nsopenGLContext();

    CGLContextObj ctx = (CGLContextObj)[mGLContext CGLContextObj];

    syphonServer = [[SyphonServer alloc]    initWithName:@”video”

    context:ctx

    options:nil];

     

    And how I push frames:

    Ogre::TexturePtr texture  = Ogre::TextureManager::getSingleton().getByName(renderPlanes[SOURCE_PREVIEW]->getOutputTexture());;

    Ogre::GLTexture* textureGl = static_cast<Ogre::GLTexture*>(texture.get());

    GLuint texId;

    texId = textureGl->getGLID();

     

    CGLLockContext(syphonServer.context);

    [syphonServer   publishFrameTexture:texId

    textureTarget:GL_TEXTURE_RECTANGLE_EXT

    imageRegion:NSMakeRect(0, 0, texture->getWidth(), texture->getHeight())

    textureDimensions:NSMakeSize(texture->getWidth(), texture->getHeight())

    flipped:NO];

    CGLUnlockContext(syphonServer.context);

    • This topic was modified 8 years, 2 months ago by tony.
    #14495
    vade
    Keymaster

    Are you sure the texture is gl texture rectangle, not 2D?

    #14511
    tony
    Participant

    It seems obvious 🙂

    I changed textureTarget to GL_TEXTURE_2D, but same error occurs.

     

    Still investigating …

    #14512
    vade
    Keymaster

    Well, a few things.

    1) ensure that the CGLContext you init the SyphonServer on is actually the active context used during rendering. Sometimes contexts get destroyed and re-created. Maybe lazy init in the render loop?

    2) ensure that the texture you are publishing is not being deleted before you publish.

    3) OpenGL Profiler, enable break on error, and ensure there are no GL errors. This is also a great place to go to Resources (when you are stopped at a break point) and verify that your textureID is valid, and matches your expectations.

    #14513
    tony
    Participant

    Thanks for your help Vade !

     

    I checked with OpenGL profile, texture ID is OK, no GL errors.

    Texture is not deleted.

    About Context im not so sure. I have multiple render windows, and multiple contexts. I tried each one, same result. I quite sure my problem is here.

    #14514
    vade
    Keymaster

    Is the GL context active, and the same as the one you’ve initted Syphon with? Just check if the CGLCOntextObj returned from CGLGetCurrentContext() matches that you’ve initted Syphon with.

    #16050
    tony
    Participant

    I must be missing something in my side

     

    Still investigating, I do not want to give up 🙂

     

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.