Right now, we are using Cocotron's implementation of OpenGL.framework (aka Core OpenGL aka CGL), which is (Win32- and) X11-specific. It is implemented as a wrapper around GLX, and AppKit (X11Window) uses both CGL and GLX calls. Furthermore, CGL itself knows about X11Windows and links to AppKit, creating a circular dependency between the two.
While this is good enough for now, it's not very future-proof, which is why we would like to implement our own version of CGL.
- It should implement the complete CGL API, as documented here
- It should wrap host's EGL, because we want it to work on X11, Wayland, and maybe even on Android
- It should not depend on AppKit
- Linking to OpenGL.framework should not bring in AppKit
- It should be possible to do offscreen rendering without any X11/Wayland connection whatsoever
- It should reexport all the
gl* symbols from the native libGL
- AppKit should only use
CGL* and gl* APIs
- And only link to OpenGL.framework, not native libGL/GLX
- CGL should provide private API extensions to let AppKit register its windowing system connection and create CGL contexts for windows/surfaces
- Think
eglGetDisplay and eglCreateWindowSurface
- Except we would also need to e.g. use
eglGetConfigAttrib() to choose the visual for X11 and pass it back to AppKit
- Should AppKit or CGL call
wl_egl_* stuff?
Right now, we are using Cocotron's implementation of OpenGL.framework (aka Core OpenGL aka CGL), which is (Win32- and) X11-specific. It is implemented as a wrapper around GLX, and AppKit (
X11Window) uses both CGL and GLX calls. Furthermore, CGL itself knows aboutX11Windows and links to AppKit, creating a circular dependency between the two.While this is good enough for now, it's not very future-proof, which is why we would like to implement our own version of CGL.
gl*symbols from the nativelibGLCGL*andgl*APIseglGetDisplayandeglCreateWindowSurfaceeglGetConfigAttrib()to choose the visual for X11 and pass it back to AppKitwl_egl_*stuff?