osgoculusviewer
osgoculusviewer copied to clipboard
How can I enable stencil functionality?
Hello,
I was wondering how to enable the stencil functionality.
I simply thought that modifying OculusDevice::createRTTCamera
would make it work but failed.
What I did was to add stencil buffer bit to the camera clear mask, and replace depth buffer attachment with the following statement:
camera->attach(osg::Camera::PACKED_DEPTH_STENCIL_BUFFER, GL_DEPTH_STENCIL_EXT);
I am a bit unsure of what you are trying to achieve. However, the Oculus SDK uses the depth buffer for Asynchronous Spacewarp calculations, so modifications of the depth buffer might have unexpected consequences.
Could there be a way to add stencil buffer in addition to the existing depth buffer? Please forgive me. I may be asking a silly question since my knowledge in OSG and Oculus is limited. I am trying to implement a Head Up Display where symbols are projected onto the transparent mirror. I was able to achieve this before with general(?) OSG viewer setup and now I am trying to make it work with the Oculus.
The Oculus SDK have a functionality called layers. There exists a separate layer type called Quad
which should be used for HeadUpDisplays and similar head locked graphics:
https://developer.oculus.com/documentation/native/pc/dg-render/#layers
I am sorry that I didn’t explain in detail. What I meant by Head Up Display was a 3D model of a HUD in a fighter aircraft where information is projected on to the transparent mirror in front of the cockpit. The ‘quad’ layer of Oculus SDK looks like a 2D screen-fixed overlay.