[osg-users] Advice on how to best inject behavoir regarding FBOs

Björn Blissing bjorn.blissing at vti.se
Sun Aug 9 08:04:10 PDT 2015


Hi Robert,

Well, I was hoping to be able to do the integration without modifications to OSG. If such modifications proves to be necessary, then I agree with Jan that we should wait for v0.7 to see if that integration is easier. It seems unnecessary to change OSG for a problem that may disappear in later Oculus SDK versions.

But I am happy to report that I have a working, flicker free solution. Although I had to make a rather cumbersome call inside my pre draw camera callback to get the FBO handle:


Code:

osg::Camera* camera = renderInfo.getCurrentCamera();
osgViewer::Renderer *camRenderer = (dynamic_cast<osgViewer::Renderer*>(camera->getRenderer()));
if (camRenderer != NULL) {
  osgUtil::SceneView* sceneView = camRenderer->getSceneView(0);
  if (sceneView != NULL) {
    osgUtil::RenderStage* renderStage = sceneView->getRenderStage();
    if (renderStage != NULL) {
      osg::FrameBufferObject* fbo = renderStage->getFrameBufferObject();
      GLuint fboHandle = fbo->getHandle(ctx);
    }
  }
}




This also forced me to link with osgUtil. I don't know if there is a simpler way of getting the FBO handle, which does not involve osgUtil?

Best regards

Björn

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64683#64683








More information about the osg-users mailing list