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

Björn Blissing bjorn.blissing at vti.se
Sat Aug 8 09:33:02 PDT 2015


I am (as some of you already know) working with the integration of the Oculus Rift and OpenSceneGraph. Usually I have been able to get the new SDK working within days of a new release. But since v0.6 of the Oculus SDK I have been struggling.

This has mainly been due to the fact that this SDK version is pretty much a completely new SDK compared to the previous version. Most of the setup is now handled inside the Rift SDK and runtime. When trying to integrate this I have run into a bit of a problem. My current implementation is almost working BUT I get serious flicker in the image and the output console is filled with messages:

Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)

I have compared the OpenGL calls from my integration with one of the pure OpenGL examples from Oculus. And the two things differs are:

1. The setup of the FBO textures requires information from the Oculus SDK. This is a bit problematic, since FBO texture setup happens inside osg::RenderStage::runCameraSetUp().

2. The Oculus SDK requires you to disconnect and reconnect the texture handle attached to the FBO each frame. This is due to the fact that Oculus direct mode uses DirectX to function and without disconnecting the texture handle at the end of each frame we would bind a framebuffer with an invalid attachment because the texture ID associated with had been unlocked by GL-DX interop.

These two problems currently blocks my integration with the Oculus SDK. I have spent way to many hours to try to find solutions how to work around these issues. 

The second problem could probably be solved by using Pre- and Post camera callbacks running the required commands.

But I have no good ideas how to solve the first issue. Subclassing osg::RenderStage and overloading the runCameraSetUp() functions seems like a really bad idea.

So if anyone have any pointers or ideas?

The current status can be pulled from:


Read this topic online here:

More information about the osg-users mailing list