Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
BlueLeopard543's avatar
BlueLeopard543
Honored Guest
9 years ago

ovr_CreateTextureSwapChainGL crashes everytime

ovrResult result = ovr_CreateTextureSwapChainGL(Session, &desc, &TextureChain);

crashes everytime: i've copied this example from many different sources, including the oculus developer guides and documentation. 

I've tried to isolate the code, but still, even having only the initialization and the desc values validation, it crashes everytime.

The initialize is the same as any initialize:

ovrResult result = ovr_Initialize(nullptr);
if (OVR_FAILURE(result))
return;
ovrSession session;
ovrGraphicsLuid luid;
result = ovr_Create(&session, &luid);
if (OVR_FAILURE(result))
{
ovr_Shutdown();
return;
}
ovrHmdDesc hmdDesc = ovr_GetHmdDesc(session);
ovrSizei resolution = hmdDesc.Resolution;

ovrTextureSwapChain textureSwapChain = 0;
ovrTextureSwapChainDesc desc = {};
desc.Type = ovrTexture_2D;
desc.ArraySize = 1;
desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
desc.Width = 256;
desc.Height = 256;
desc.MipLevels = 1;
desc.SampleCount = 1;
desc.StaticImage = ovrFalse;

The error in the debug is Unhandled exception at 0x00000000 in A.exe: 0xC0000005: Access violation., but it doesn't help a lot.


Why do I have this problem? Can you help me? Somebody else got the same issue?

Thanks

4 Replies

  • Anonymous's avatar
    Anonymous
    Did you initialized OpenGl an do you have a current OpenGl contect when you do this ? If you work with some examples I belive so. Do the prebuild examples work ? What about graphic card drivesrs update ?
  • Hello, thank you for your answer.

    I just double checked, I got the last drivers for my nvidia graphic card.

    Every other VR application and game works fine.

    I can compile and run successfully every sample room in the oculus sample projects.

    What about this openGL initializing that you're talking about? I don't see anything like that in the sample code, or maybe I just missed it. The only initializing code that I have in the project is that one that I post in the previous comment.

    Could be this the reason for the crash? I'll take a look and eventually repost here if I can't find anything about it.

    Thanks
  • Anonymous's avatar
    Anonymous
    It can not work without initializing OpenGl. You should:
    1 make a functional OpenGl application
    2 add to this application your OVR stuff
    3 be sure you initialize all the OpenGl stuff (context, extensions support) before you add any OVR code

    The same for DirectX.

    The Rift inicialization expects you had already done the OpenGl or DirectX inicialization.
    It can not do this - it have no idea what futures do you want init.
  • Anonymous's avatar
    Anonymous
    You missed the OpenGl initialization becouse it is probably hidden in the platform SDK ?