$ ~/Downloads/Pessoal/etudes/etudes_c/SDL2_Basic_Setup/out/bin $ ./SDL2_Basic_Setup
Display mode is 1440x900px @ 60hz
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.
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