Home › Forums › Syphon › Syphon Development – Developer › Syphon and Ogre
Tagged: ogre3D
- This topic has 6 replies, 2 voices, and was last updated 8 years, 2 months ago by tony.
-
AuthorPosts
-
December 20, 2012 at 3:01 am #14202tonyParticipant
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.
December 21, 2012 at 7:05 am #14495vadeKeymasterAre you sure the texture is gl texture rectangle, not 2D?
December 21, 2012 at 10:08 am #14511tonyParticipantIt seems obvious 🙂
I changed textureTarget to GL_TEXTURE_2D, but same error occurs.
Still investigating …
December 21, 2012 at 11:16 am #14512vadeKeymasterWell, 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.
December 21, 2012 at 12:36 pm #14513tonyParticipantThanks 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.
December 21, 2012 at 2:53 pm #14514vadeKeymasterIs 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.
January 2, 2013 at 8:31 am #16050tonyParticipantI must be missing something in my side
Still investigating, I do not want to give up 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.