Fix studio python samples when running on CRD

* Changed window.cc to not pass `SDL_WINDOW_OPENGL` for headless opengl graphics modes since this requests a [GLX visual](https://tronche.com/gui/x/xlib/window/visual-types.html#Visual) but CRD's virtual X11 display has no GLX visuals causing window creation to fail with "Couldn't find matching GLX visual".

* Changed `TryLoadEgl` so it fails if `eglBindAPI(EGL_OPENGL_API)` does not return true, causing `CreateFilamentPlatform` to fallback to OSMesa on CRD.

PiperOrigin-RevId: 918029935
Change-Id: Id88338811949b1402578de19bc4d31f4ee1783c1
This commit is contained in:
Matija Kecman
2026-05-19 14:27:26 -07:00
committed by Copybara-Service
parent bdf00966f9
commit dd37ae16fc
+3 -1
View File
@@ -104,7 +104,9 @@ Window::Window(std::string_view title, int width, int height, Config config)
}
int window_flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
if (IsVulkan(config_.gfx_mode)) {
if (IsHeadless(config_.gfx_mode)) {
// No additional window flags needed for headless rendering.
} else if (IsVulkan(config_.gfx_mode)) {
window_flags |= SDL_WINDOW_VULKAN;
} else if (IsWebGl(config_.gfx_mode)) {
window_flags |= SDL_WINDOW_OPENGL;