summaryrefslogtreecommitdiff
path: root/cogl/cogl-context-private.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-07-07 20:44:56 +0100
committerNeil Roberts <neil@linux.intel.com>2011-07-11 12:57:38 +0100
commitb2e735ff7f4094056765ff6adb5c74fd51d11e4a (patch)
treefa2d813eef3d138c86208d0a263fb94580059367 /cogl/cogl-context-private.h
parent5f181973a68ba9048f89cbf623ddcdc95ce7c415 (diff)
downloadcogl-b2e735ff7f4094056765ff6adb5c74fd51d11e4a.tar.gz
Dynamically load the GL or GLES library
The GL or GLES library is now dynamically loaded by the CoglRenderer so that it can choose between GL, GLES1 and GLES2 at runtime. The library is loaded by the renderer because it needs to be done before calling eglInitialize. There is a new environment variable called COGL_DRIVER to choose between gl, gles1 or gles2. The #ifdefs for HAVE_COGL_GL, HAVE_COGL_GLES and HAVE_COGL_GLES2 have been changed so that they don't assume the ifdefs are mutually exclusive. They haven't been removed entirely so that it's possible to compile the GLES backends without the the enums from the GL headers. When using GLX the winsys additionally dynamically loads libGL because that also contains the GLX API. It can't be linked in directly because that would probably conflict with the GLES API if the EGL is selected. When compiling with EGL support the library links directly to libEGL because it doesn't contain any GL API so it shouldn't have any conflicts. When building for WGL or OSX Cogl still directly links against the GL API so there is a #define in config.h so that Cogl won't try to dlopen the library. Cogl-pango previously had a #ifdef to detect when the GL backend is used so that it can sneakily pass GL_QUADS to cogl_vertex_buffer_draw. This is now changed so that it queries the CoglContext for the backend. However to get this to work Cogl now needs to export the _cogl_context_get_default symbol and cogl-pango needs some extra -I flags to so that it can include cogl-context-private.h
Diffstat (limited to 'cogl/cogl-context-private.h')
-rw-r--r--cogl/cogl-context-private.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index 87b0d6c3..8ffcba19 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -56,6 +56,8 @@ struct _CoglContext
CoglDisplay *display;
+ CoglDriver driver;
+
/* vtable for the texture driver functions */
const CoglTextureDriver *texture_driver;
@@ -86,10 +88,8 @@ struct _CoglContext
API. We keep track of the matrix stack that Cogl is trying to
flush so we can flush it later after the program is generated. A
reference is taken on the stacks. */
-#ifdef HAVE_COGL_GLES2
CoglMatrixStack *flushed_modelview_stack;
CoglMatrixStack *flushed_projection_stack;
-#endif /* HAVE_COGL_GLES2 */
GArray *texture_units;
int active_texture_unit;
@@ -287,6 +287,18 @@ _cogl_context_get_default ();
const CoglWinsysVtable *
_cogl_context_get_winsys (CoglContext *context);
+/* Check whether the current GL context is supported by Cogl */
+gboolean
+_cogl_context_check_gl_version (CoglContext *context,
+ GError **error);
+
+/* Query the GL extensions and lookup the corresponding function
+ * pointers. Theoretically the list of extensions can change for
+ * different GL contexts so it is the winsys backend's responsiblity
+ * to know when to re-query the GL extensions. */
+void
+_cogl_context_update_features (CoglContext *context);
+
/* Obtains the context and returns retval if NULL */
#define _COGL_GET_CONTEXT(ctxvar, retval) \
CoglContext *ctxvar = _cogl_context_get_default (); \