bjornblissing / osgoculusviewer

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

Added option to blit on camera PostDraw #106

Closed rickyviking closed 3 years ago

rickyviking commented 3 years ago

Added the option to blit the mirror camera on the Oculus Right eye camera PostDraw callback rather than swap callback. This allows other cameras rendering in POST to draw after the texture blit, allowing for instance to visualize osg stats.

See attached image for the OsgOculusViewerExample with the stats enabled (I think the huge update time is just due to the viewer waiting for the next swap buffer, saturated at 80Hz by the Oculus SDK).

image

bjornblissing commented 3 years ago

If my memory serves me correctly Oculus advised against assuming that the eyes were rendered in a specific order. But maybe this have changed?

rickyviking commented 3 years ago

It might well be as you remember, but that applies to how the Oculus SDK renders to the device, i.e. after submitting the frame to the Oculus SDK in the swap callback. The 2 osg cameras instead are rendered in a specific order (left and right), see: https://github.com/bjornblissing/osgoculusviewer/blob/master/src/oculusdevice.cpp#L221 So, after the right eye camera has been rendered by osg, the frame which will be sent to the Oculus in the swap callback is complete and should be OK to blit it to the mirror texture.

bjornblissing commented 3 years ago

closed by 0e9e521679d5ba62d8e3f7bfdcbe7ce8ebff7913