$ ~/Downloads/Pessoal/etudes/etudes_c/SDL2_Basic_Setup/out/bin $ ./SDL2_Basic_Setup
SDL INITIALISED
Display mode is 1440x900px @ 60hz
^C
Created Window and Renderer 640x480
I’ve first installed all necessary libs from brew. With no luck, I’ve deleted every sdl2 lib from brew and downloaded the sources and compiled it… to no avail. Same output: Window freezes, doesn’t show up, and if I hit Ctrl-C on the terminal window, it shows and closes itself.
I ran the sample with sudo just in case, same issue.
This whole trouble is because kivy uses sdl2, this was my initial try, running a sample python kivy app on python 3.9.5.
I can’t seem to make kivy use other configuration for KIVY_WINDOW, all fail in window creation, only sdl2 passes then hangs. A ctrl-c displays the sdl window and closes it in a second.
Why are you trying to use X11? It isn’t needed for SDL to work on macOS.
Also, he means the video driver, not the renderer backend. If you add printf("Video driver: %s\n", SDL_GetCurrentVideoDriver());
before the window is created, what does it print?
As has been pointed out, OpenGL is supported by MacOS (even on the new ‘Apple Silicon’ M1) which is fortunate for me because my app depends on it. It’s officially deprecated but I think Apple would be crazy to remove support for the one ‘universal’ backend that’s available on virtually every platform.
then don’t install SDL from brew? SDL provides a precompiled framework for Mac that works just fine with OpenGL
maybe you have a SDL_VIDEODRIVER=x11 environment variable someplace?
This was the only reference I found to setup OpenGL without X11 on Mac OS, and it has different headers.
there isn’t really a trick to getting OpenGL on Mac except perhaps the headers are under an OpenGL directory (eg #include <OpenGL/gl.h>), but you will be limited to a 4.1 or lower context. Just add the OpenGL framework (ships with macOS) to your project and link it. I don’t use anything like glfw tho.
OpenGL isn’t something you need to install; on macOS it’s provided by the operating system. If you aren’t doing anything with OpenGL directly then you don’t need to even worry about it. And if you do want to do stuff with OpenGL, use SDL to set up the OpenGL context instead of doing it yourself.
And since it’s using the Cocoa video driver, I’m guessing there’s some other problem.
What happens if you create the window and SDL_Renderer separately? As in, like