How to select EGL backend in SDL2

I switched from GLEW to ANGLE recently, and it was relatively painless beyond having to set a few hints. One thing I haven’t been able to do, however, is select the EGL backend through SDL2. Is this possible? Is it possible on SDL3? On my Windows computers, for example, EGL seems to always use D3D11 even if I try setting the render_driver or videodriver hints to “opengl”. I assume since SDL’s creating the window, it has to also set the backend.

Conceivably I could compile ANGLE with only Vulkan if that’s the backend I want to test, but it seems like there should be a simpler way to do this using SDL. I read a few posts about selecting the backend, but I didn’t see a conclusion.

Thanks!

You can certainly select the GL backend in Windows, but I’ve not tried EGL:

SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
window = SDL_CreateWindow(..., ..., ..., ..., ..., SDL_WINDOW_OPENGL);

Thank you so much for the reply! I meant to get back to you about this. I’m able to select the backend that SDL is using but I haven’t had any luck changing it for EGL. ANGLE seems determined to use Direct 3D on Windows no matter what hints I use, so I’m guessing that SDL is choosing the best driver that’s available for the platform, which makes sense even though I would’ve liked the ability to change it.

I don’t have a compelling reason to change it (I could recompile ANGLE without Direct 3D and see if it chooses Vulkan, for example) so I moved onto more important issues. :slight_smile: Still, if anyone can figure out how to change this, I’d like to know. From reading angle/doc/DevSetup.md at main · google/angle · GitHub , my understanding is that SDL would need to implement EGL_ANGLE_platform_angle unless there’s a workaround for initializing EGL.