1 hour ago, mullich said:
The question is, is it possible to create a context directly on a window?
No, not with modern APIs. NSView subclasses are the drawing and compositing mechanism for Cocoa, so you must use them to do any drawing or compositing, including via OpenGL. Creating a GL context "for a window" in Cocoa is largely meaningless and wouldn't be any "faster." It's like asking to create an OpenGL context for a NSError object.
You can create a custom NSView subclasses though, and build your OpenGL use around that. It isn't any faster per se, but it does afford you more control (at the cost of usability).
As iedoc notes, the whole rendering-to-a-buffer-and-flipping thing is what you want to do, otherwise you get artifacts that you can't control for since you don't have that level of control over the graphics hardware on any modern OS. The flipping is not slow.
If you're really that worried about every little microsecond and you have a good reason to be, you should drop OpenGL anyway. Metal is significantly better at giving you low level control over what matters, and Apple clearly cares much more about it than OpenGL, so this is only going to become more apparent. It is slightly harder to use, however.