fe3aa8b8b3
The GL3 context is created using the glXCreateContextAttribs function which is part of the GLX_ARB_create_context extension. However previously the function pointers from GLX extensions were only retrieved once the GL context is created. That meant that the GL3 context creation function would always assume that the extension is not supported so it would always fail. This patch changes it to query the functions when the renderer is set up instead. The base winsys feature flags that are determined while querying the functions are stored in a member of CoglGLXRenderer. These are then copied to the CoglContext when it is initialised. The spec for glXGetProcAddress says that the functions returned are context-independent. That implies that it is safe to call it without binding a context although that is not explicitly stated as far as I can tell. A big of googling finds this DRI documentation which says it can be used without a context: http://dri.freedesktop.org/wiki/glXGetProcAddressNeverReturnsNULL And also this code sample: http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29 One point that makes me concerned that this might not always work in practice is that the code in SDL2 to create a GL3 context first creates a dummy GL2 context in order to have something bound before it calls glXGetProcAddress. I think this may just be a misunderstanding based on how wglGetProcAddress works however. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 04a7aca9a98e84e43ac5559305a1358112902e30) |
||
---|---|---|
.. | ||
cogl-texture-pixmap-x11-private.h | ||
cogl-texture-pixmap-x11.c | ||
cogl-texture-pixmap-x11.h | ||
cogl-winsys-egl-android-private.h | ||
cogl-winsys-egl-android.c | ||
cogl-winsys-egl-feature-functions.h | ||
cogl-winsys-egl-gdl-private.h | ||
cogl-winsys-egl-gdl.c | ||
cogl-winsys-egl-kms-private.h | ||
cogl-winsys-egl-kms.c | ||
cogl-winsys-egl-null-private.h | ||
cogl-winsys-egl-null.c | ||
cogl-winsys-egl-private.h | ||
cogl-winsys-egl-wayland-private.h | ||
cogl-winsys-egl-wayland.c | ||
cogl-winsys-egl-x11-private.h | ||
cogl-winsys-egl-x11.c | ||
cogl-winsys-egl.c | ||
cogl-winsys-glx-feature-functions.h | ||
cogl-winsys-glx-private.h | ||
cogl-winsys-glx.c | ||
cogl-winsys-private.h | ||
cogl-winsys-sdl2.c | ||
cogl-winsys-sdl-private.h | ||
cogl-winsys-sdl.c | ||
cogl-winsys-stub-private.h | ||
cogl-winsys-stub.c | ||
cogl-winsys-wgl-feature-functions.h | ||
cogl-winsys-wgl-private.h | ||
cogl-winsys-wgl.c | ||
cogl-winsys.c |