Showing results for 
Search instead for 
Did you mean: 

ovr_CreateTextureSwapChainGL fails with error -3000 when trying to make cube textures

Using the OculusRoomTiny(GL) as a test, the following code fails with error -3000 (ovrError_Initialize):
ovrTextureSwapChainDesc desc2 = {};
desc2.Type = ovrTexture_Cube;
desc2.ArraySize = 6;
desc2.Width =512;
desc2.Height = 512;
desc2.MipLevels = 1;
desc2.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
desc2.SampleCount = 1;
desc2.StaticImage = ovrTrue;
ovrResult result = ovr_CreateTextureSwapChainGL(Session, &desc2, &ColorTextureChain);
The error is happening inside of wglDXRegisterObjectNV.

Changing just the type to ovrTexture_2D succeeds.

In the ovr_capi.h the declaration for ovrTextureSwapChainDesc includes these two lines:
ovrTextureType Type; ///< Must be ovrTexture_2D
int ArraySize; ///< Must be 6 for ovrTexture_Cube, 1 for other types.
These are mutually exclusive though. If the Type can never be ovrTexture_Cube, then why say an array size must be 6 for that impossible type?
Are cube maps really no longer possible? That note wasn't in older sdks (I know 1.26 didn't have it, but 1.35 does. I haven't checked between there)

This is the reason the X-Plane simulator is failing to run on Oculus headsets in OpenGL. I've been debugging why the game fails to start and I've tracked it's Oculus SDK usage down to the exact parameters to ovr_CreateTextureSwapChainGL above. I put those values into the OculusRoomTiny(GL) demo and it gives the same error. By intercepting their call to ovr_CreateTextureSwapChainGL and replacing the type with ovrTexture_2D the simulator runs correctly (I don't know what they are using a low res cube map for, probably a reflection).

This has only started crashing X-Plane in Oculus v17, before that it was ok, so it sounds like something has changed.

(Note: I'm not connected to X-Plane, I'm just trying to debug why it now fails for the people over on the oculus community boards)