From 410ed81027232e669bf6a28699fa833e56a27ef7 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 25 Nov 2009 14:04:28 +1000 Subject: Bind the EGL API type before calling eglMakeCurrent() When mixing GL and VG in the same thread, some devices require that eglBindAPI() be called before eglMakeCurrent() when switching between context types. The EGL spec indicates that this shouldn't be required unless the context parameter is EGL_NO_CONTEXT, but it isn't a big deal to work around slightly non-compliant devices. Reviewed-by: Tom Cooksey --- src/gui/egl/qegl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index c0e4890..cf28dc4 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -236,6 +236,18 @@ bool QEglContext::makeCurrent(EGLSurface surface) currentSurface = surface; setCurrentContext(apiType, this); + // Force the right API to be bound before making the context current. + // The EGL implementation should be able to figure this out from ctx, + // but some systems require the API to be explicitly set anyway. +#ifdef EGL_OPENGL_ES_API + if (apiType == QEgl::OpenGL) + eglBindAPI(EGL_OPENGL_ES_API); +#endif +#ifdef EGL_OPENVG_API + if (apiType == QEgl::OpenVG) + eglBindAPI(EGL_OPENVG_API); +#endif + bool ok = eglMakeCurrent(dpy, surface, surface, ctx); if (!ok) qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError()); -- cgit v0.12