bjornblissing / osgoculusviewer

An OsgViewer with support for the Oculus Rift
Other
106 stars 67 forks source link

Explicitly realize the viewer and call setReleaseContextAtEndOfFrameHint(false) #98

Closed rickyviking closed 5 years ago

rickyviking commented 5 years ago

Hi @bjornblissing

I suggest the following change to the OculusViewerExample to stress that it's mandatory to call setReleaseContextAtEndOfFrameHint(false) in order not to get a GL warning message at every frame during the execution. It was hard for me to track down where the warning was coming from in my application, because the method viewer.run() "hides" this initialization, so I think it's best to make it explicit. I'm using osg 3.6.3 and Oculus SDK 1.30

bjornblissing commented 5 years ago

I have had similar warnings before. A couple of questions before I merge this:

Have these warnings stated to show with the latest Oculus SDK (1.30) or have you always had these?

Would it be possible to add the call to the RealizeOperation instead and thus hide the call from the users of the library?

https://github.com/bjornblissing/osgoculusviewer/blob/0c1c7363429a2ebb54934c5f1d51076e5d4fc781/src/oculusdevice.cpp#L415

rickyviking commented 5 years ago

Hi, I've seen you had this issue before, but the codebase has changed quite a lot since then and I couldn't bring back the situation to the one you had found.

I didn't have this issue with osg 3.5.3 and an Oculus SDK 1.5.0 - then I've updated to osg3.6.3 and Oculus 1.30.0 and I've got the warning message. I haven't tested anything in between.

To hide the call as you suggest, I've implemented the change in the OculusViewer class where you already have access to the osg view: I've changed the param to Viewer instead of ViewerBase to avoid passing 2 parameters for the same object, given that CompositeViewer with multiple GL contexts should not be used anyway with the Oculus.