Reply To: OpenGL 3.2 Context causes glitches?

Home Forums Syphon Syphon Development – Developer OpenGL 3.2 Context causes glitches? Reply To: OpenGL 3.2 Context causes glitches?

#6191
ZeroStride
Participant

No changes needed to SDK, but (as far as I can tell) the best way to do this is to publish the frame by calling bindToDrawFrameOfSize/unbindAndPublish then use glBlitFramebuffer to copy your framebuffer into the Syphon one. This eliminates all unsupported, fixed-function API calls.

My solution( https://gist.github.com/3156964)

CGLLockContext(_syServer.context);
CGLSetCurrentContext(_syServer.context);
[_syServer bindToDrawFrameOfSize:_syTexSz];
GLint syFBO;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &syFBO);
glBindFramebuffer(GL_READ_FRAMEBUFFER, _blitTarget->framebuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, syFBO);

glBlitFramebuffer(0, 0, _blitTarget->width, _blitTarget->height,
0, 0, _blitTarget->width, _blitTarget->height,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
[_syServer unbindAndPublish];
CGLUnlockContext(_syServer.context);

It could be useful to add a -[SyphonServer publishFramebuffer:imageRegion:textureDimensions:] method, something like this maybe: https://gist.github.com/3156985