bjornblissing / osgoculusviewer

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

Is SingleThreaded the mandatory threading option? #100

Open rickyviking opened 5 years ago

rickyviking commented 5 years ago

Hi @bjornblissing,

the viewer example forces the osg threading model to SingleThreaded - see here. Is this actually mandatory? With CPU-bound scenes, using other schemes such as DrawThreadPerContext might help to improve the framerate.

bjornblissing commented 5 years ago

If I remember correctly the single threaded model is the model with the lowest latency. Other threading models may add another frame of latency, at least according to Robert's answer in this old thread: http://forum.openscenegraph.org/viewtopic.php?p=62642#62642

However this might be an old and outdated truth.

bjornblissing commented 5 years ago

One way to test other threading models would be to use the Oculus Debug Tool to print some performance diagnostics and then changing between different threading models. For your application some other threading model might be more preferable compared to running single threaded.

https://developer.oculus.com/documentation/pcsdk/latest/concepts/dg-debug-tool/

rickyviking commented 5 years ago

Thank you, I will definitely give it a try and report back here!

Besides the latency, I was wandering if there were any other issue related to how fbo cameras are sent to the Oculus or similar sync problems, as the comment above the line which forces SingleThreaded states: // Force single threaded to make sure that no other thread can use the GL context

rickyviking commented 5 years ago

Hi @bjornblissing apparently there are no issues using other threading models - I've mostly used DrawThreadPerContext and investigating if/how much performance gain I get from that.

As a side question (we might open another issue if appropriate) I'd like to know what is the suggested way to add the osg stats (and possibly other HUDs) on top of the preview window. Is there a clean way to render those cameras after blitting the texture from Oculus to the preview window?