Hi,
I am making a multi monitor installation. I want to make a offscreen render first with ofFbo and send the texture to a syphon client.
in the beginning of the sketch I was thinking to allocate a ofFbo
void beginSyphon(){
// Clear with alpha, so we can capture via syphon and composite elsewhere should we want.
// glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
offscreenRender.allocate(7680,720,GL_RGBA);
// offscreenRender.bind();
glEnable(offscreenRender.getTextureReference().texData.textureTarget);
}
I looked at the loadscreenData void in ofTexture. At the end of the draw function i’ve added this:
void endSyphon(){
ofSetColor(255, 255, 255);
ofEnableAlphaBlending();
glDisable(offscreenRender.getTextureReference().texData.textureTarget);
// offscreenRender.unbind();
/// int screenHeight = ofGetViewportHeight(); // this call fails if we are in a different viewport or FBO: ofGetHeight();
int w = 7680;
int h = 720;
int x = 0;
int y = 7680 - 0;
y -= 720; // top, bottom issues
offscreenRender.getTextureReference().texData.bFlipTexture = true;
if ( w > offscreenRender.getTextureReference().texData.tex_w || h > offscreenRender.getTextureReference().texData.tex_h) {
ofLog(OF_LOG_ERROR,"image data too big for allocated texture. not uploading...");
return;
}
//update our size with the new dimensions - this should be the same size or smaller than the allocated texture size
offscreenRender.getTextureReference().texData.width = w;
offscreenRender.getTextureReference().texData.height = h;
//texData.glType = GL_RGB; // this was probably a bug, because you might be resetting the glType to something other than what the texture was created for
//compute new tex co-ords based on the ratio of data's w, h to texture w,h;
#ifndef TARGET_OPENGLES // DAMIAN
if (offscreenRender.getTextureReference().texData.textureTarget == GL_TEXTURE_RECTANGLE_ARB){
offscreenRender.getTextureReference().texData.tex_t = (float)(w);
offscreenRender.getTextureReference().texData.tex_u = (float)(h);
} else
#endif
{
offscreenRender.getTextureReference().texData.tex_t = (float)(w) / (float)offscreenRender.getTextureReference().texData.tex_w;
offscreenRender.getTextureReference().texData.tex_u = (float)(h) / (float)offscreenRender.getTextureReference().texData.tex_h;
}
// glBindTexture(offscreenRender.getTextureReference().texData.textureTarget, (GLuint)offscreenRender.getTextureReference().texData.textureID);
// glCopyTexSubImage2D(offscreenRender.getTextureReference().texData.textureTarget, 0,0,0,x,y,w,h);
mainOutputSyphonServer.publishTexture(&offscreenRender.getTextureReference());
offscreenRender.getTextureReference().clear();
// individualTextureSyphonServer.publishTexture(&tex);
}
};
I’m using two 7 series ATI graphics card on a mac so it’s fast enough to do high resolutions. I’ve allready tried different variations, but I can’t get it working. I get a weird response on the screen and the framerate is still above 30 fps.