-[NSOpenGLContext setView:] must be called from the main thread

Trying to run OpenGL on M3 macOS Sonoma. I keep getting this error. Does anyone have any ideas on how to fix it (without using Metal)?