5 #define EGL_EGL_PROTOTYPES 0
8 #include <EGL/eglext.h>
27#include <KHR/khrplatform.h>
28#include <GL/glcorearb.h>
35#if defined( __APPLE__ )
37 @class NSOpenGLContext;
38 typedef NSOpenGLContext* NSContextPtr;
40 typedef struct NSOpenGLContext* NSContextPtr;
47 struct GraphicsDeviceSettings;
52 typedef HDC NativeDisplay;
53#elif defined(COGS_GLX)
54 typedef Display* NativeDisplay;
55#elif defined(COGS_EGL)
56 typedef EGLNativeDisplayType NativeDisplay;
58 typedef void* NativeDisplay;
67 Platform platform = Platform::None;
70 bool setUpGLDebugging(
const char* contextName, GLContextBase::Platform platform);
75 ~GLContext() { destroy(); }
77 bool create(NativeDisplay display, WindowData* windowData, GLContext* shareContext,
const GraphicsDeviceSettings* settings, Platform desiredPlatform,
bool debug);
79 void swapBuffers(uint32_t syncInterval, uint32_t presentFlags);
83 HGLRC context =
nullptr;
84 HWND headlessHwnd =
nullptr;
89struct GLContext : GLContextBase
91 GLContext(NSContextPtr c =
nullptr) : context(c) {}
92 ~GLContext() { destroy(); }
94 bool create(NativeDisplay display, WindowData* windowData, GLContext* shareContext,
const GraphicsDeviceSettings* settings, Platform desiredPlatform,
bool debug);
96 void swapBuffers(uint32_t syncInterval, uint32_t presentFlags);
105 struct GLContext : GLContextBase
107 ~GLContext() { destroy(); }
109 bool create(NativeDisplay display, WindowData* windowData, GLContext* shareContext,
const GraphicsDeviceSettings* settings, Platform desiredPlatform,
bool debug);
111 void swapBuffers(uint32_t syncInterval, uint32_t presentFlags);
114 static GLXFBConfig getFBConfig(NativeDisplay display,
int requestedSampleCount);
115 static XVisualInfo* getVisualInfo(Display* display, GLXFBConfig fbConfig);
117 Display* dpy =
nullptr;
119 GLXContext glc =
nullptr;
120 static GLXFBConfig fbConfig;
122 bool ownWindow =
false;
123 bool ownContext =
false;
125 bool getGLXFuncPointers();
129 struct GLContext : GLContextBase
131 ~GLContext() { destroy(); }
133 EGLDisplay eglDisplay =
nullptr;
134 EGLContext eglContext =
nullptr;
135 EGLSurface eglSurface =
nullptr;
136 bool ownContext =
false;
137 bool ownDisplay =
false;
139 bool create(NativeDisplay display, WindowData* windowData, GLContext* shareContext,
const GraphicsDeviceSettings* settings, Platform desiredPlatform,
bool debug);
141 void swapBuffers(uint32_t syncInterval, uint32_t presentFlags);
146 bool getGLFuncPointers();
147 bool getGLES3FuncPointers(GLContextBase::Platform platform);
Contains all Cogs related functionality.