Forum Discussion
Anonymous
11 years agoAnyone got working example with ovrLayerType_QuadHeadLocked?
Does anyone know of a publicly readable code example of a working Rift application that uses ovrLayerType_QuadHeadLocked or ovrLayerType_QuadInWorld?
I'm following the developer documentation at https://developer.oculus.com/documentat ... der_layers
I got my basic rendering working with SDK 0.7, and now I'm trying to add a second layer. I'm pretty much following the code example in the documentation (except the symbol "ovrLayerType_Quad" in the docs, does not appear to exist in SDK 0.7). I figure the "ovrLayerType_QuadHeadLocked" is probably more likely than "ovrLayerType_QuadInWorld" to lead to the first experience of "Hey I seem my layer actually rendering for the first time", but I have experimented with each, and I have yet to see any evidence of a second layer.
Sorry I don't have a complete code example at the moment. This is embedded in 100,000 lines of code. But if this problem drags on, I will probably try to implement a simple standalone example using the AWESOME PYTHON BINDINGS I recently made.
I'm following the developer documentation at https://developer.oculus.com/documentat ... der_layers
I got my basic rendering working with SDK 0.7, and now I'm trying to add a second layer. I'm pretty much following the code example in the documentation (except the symbol "ovrLayerType_Quad" in the docs, does not appear to exist in SDK 0.7). I figure the "ovrLayerType_QuadHeadLocked" is probably more likely than "ovrLayerType_QuadInWorld" to lead to the first experience of "Hey I seem my layer actually rendering for the first time", but I have experimented with each, and I have yet to see any evidence of a second layer.
Sorry I don't have a complete code example at the moment. This is embedded in 100,000 lines of code. But if this problem drags on, I will probably try to implement a simple standalone example using the AWESOME PYTHON BINDINGS I recently made.
// Second Monoscopic Quad layer for menus
// Create HUD layer, fixed to the player's torso
hudLayer.Header.Type = ovrLayerType_QuadHeadLocked; // Was non-existent "ovrLayerType_Quad" in the docs...
hudLayer.Header.Flags = ovrLayerFlag_TextureOriginAtBottomLeft | ovrLayerFlag_HighQuality;
hudLayer.ColorTexture = hudTextureSet; // single texture for both eyes;
// 50cm in front and 20cm down from the player's nose,
// fixed relative to their torso.
float hudScale = 1.0f;
hudLayer.QuadPoseCenter.Position.x = 0.00f * hudScale;
hudLayer.QuadPoseCenter.Position.y = -0.20f * hudScale;
hudLayer.QuadPoseCenter.Position.z = -0.50f * hudScale;
hudLayer.QuadPoseCenter.Orientation = ovrQuatf();
// HUD is 50cm wide, 30cm tall.
hudLayer.QuadSize.x = 0.50f * hudScale;
hudLayer.QuadSize.y = 0.30f * hudScale;
// Display all of the HUD texture.
hudLayer.Viewport.Pos.x = 0.0f;
hudLayer.Viewport.Pos.y = 0.0f;
hudLayer.Viewport.Size.w = 1.0f;
hudLayer.Viewport.Size.h = 1.0f;
9 Replies
- thewhiteambitAdventurerIt seems you are missing ovrViewScaleDesc
ovrViewScaleDesc viewScaleDesc;
viewScaleDesc.HmdSpaceToWorldScaleInMeters = 1.0f;
viewScaleDesc.HmdToEyeViewOffset[0] = hmdToEyeViewOffset[0];
viewScaleDesc.HmdToEyeViewOffset[1] = hmdToEyeViewOffset[1];
AlsohudLayer.Header.Flags = ovrLayerFlag_HeadLocked;
is now a Flag for usage withhudLayer.Header.Type = ovrLayerType_Quad;
- beside this, I also did not get it to work. guess there is no official information about this - the SDK states there is the capability of Quad rendering, but maybe it is one of these pitfalls again were you can waste a week or two trying out why quad rendering is not working and then get information the SDK states wrong about availability of this feature...
PS: before I a am about to waste a week or two because of bugs in the SDK (again!), it would be great to get an official statement on this! - joanProtegeOculusWorldDemo makes use of it.
Hit TAB to raise the main menu then Layers, set Layers Enabled to ON, then set World Layer Enabled to ON. The quad is floating beside the staircase.
Do a search in OculusWorldDemo.cpp, it starts line 2087, several demo layers use this type. - thewhiteambitAdventurerThank you very much, got it working now. Seems one line from the Oculus Documentation was the "hint" that killed it
hudLayer.QuadPoseCenter.Orientation = ovrQuatf();
Is not giving you a neutral whatever rotation, but an completely invalid quaternion, leading to a non rendered/visible QuadLayer. Why for sake does anybody add such a nonsense to the very one documentation example if it is working worse than guessing... - That's odd. Looking at the source, ovrQuatf() should be returning a valid unit length identity quaternion. Is the value something other than wxyz=1,0,0,0?
- thewhiteambitAdventurerNope, its all Zeros... just made an output directly after assigning, quad was gone again...
...and looking at the code, I have no idea how w could/should become 1 by itself...
/// A quaternion rotation.
typedef struct OVR_ALIGNAS(4) ovrQuatf_
{
float x, y, z, w;
} ovrQuatf; - Ah, yep, you're right. I was looking in the C++ quaternion code (which has a valid constructor setting w to 1), not the C code (which is of course just an uninitialised struct). Assigning ovrQuatf() to anything is pointless.
The Quat class in OVR_Math.h has a C compatibility cast operator that gives an ovrQuatf, so you could probably do:
hudLayer.QuadPoseCenter.Orientation = Quat();
although I haven't tried. - thewhiteambitAdventurerThx. I just assigned the values by hand. No problem assigning a quaternion, just a bit frustrating seeing a 2 billion $ funding not being able to test the very simplest of Documentation leading to developers sometimes loosing weeks (as with that totally useless 0.7 release) - that is how one can save this little extra cost of verifying a manual... how great private developers loosing time is nothing OculusVR has to pay for...
- cyberealityGrand ChampionI will have someone fix this. Thanks for bringing it up.
- thewhiteambitAdventurerIts been two weeks, and the Documentation is still wrong! Two more weeks developers can fall into this open pitfall...
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years ago
- 8 months ago
- 6 years ago