Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] OpenXR: xrCreateSwapchain changes current OpenGL context #421

Closed
ChristophHaag opened this issue Jan 26, 2021 · 6 comments
Closed
Labels

Comments

@ChristophHaag
Copy link
Contributor

I believe this is a regression in 1.16.x.

This message would be printed with 1.16.x.

GLXContext glxContext = glXGetCurrentContext();

xrCreateSwapchain(session, &swapchain_create_info, &swapchain);

if (glXGetCurrentContext() != glxContext) {
    printf("xrCreateSwapchain changed current gl context\n");
}

Applications now have to call

glXMakeCurrent(graphics_binding_gl.xDisplay, graphics_binding_gl.glxDrawable, graphics_binding_gl.glxContext);

after creating swapchains, which is quite unexpected behavior.

@ChristophHaag
Copy link
Contributor Author

same for xrWaitSwapchainImage, possibly others.

@ChristophHaag
Copy link
Contributor Author

This also breaks hello_xr -G OpenGL

@ChristophHaag
Copy link
Contributor Author

@ChristophHaag
Copy link
Contributor Author

Made a quick&dirty API layer https://github.com/ChristophHaag/gl_context_fix_layer

After every of the affected OpenXR API calls it calls glxMakeCurrent() with the Display*, GLXContext and GLXDrawable originally passed in the XrGraphicsBindingOpenGLXlibKHR. This might not be what applications actually want, but it gets at least hello_xr -G OpenGL working.

@amalon
Copy link

amalon commented May 14, 2023

This issue appears to have been fixed in 1.25 (though I see nothing obviously related in the release notes):
#546 (comment)

Anyway, it works for me without workarounds in 1.26.2. I guess this issue can be closed now.

@ChristophHaag
Copy link
Contributor Author

I haven't tried it but I take your word for it :)

thomasblanchard21 pushed a commit to thomasblanchard21/LIS_VR_app that referenced this issue Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants