which library should OpenGL ES clients link to?
krh at bitplanet.net
Wed Nov 10 06:02:04 PST 2010
On Wed, Nov 10, 2010 at 12:37 AM, Chia-I Wu <olvaffe at gmail.com> wrote:
> Hi list,
> I am curious which library should, say, gears links to when it is
> ported to OpenGL ES 2.0. libGL.so or libGLESv2.so? I'd like to say
> libGLESv2, but cairo links to libGL and there is going to be a
> conflict: both libraries export _glapi_tls_Dispatch for current
> dispatch table. It is not possible to tell which _glapi_tls_Dispatch
> eglMakeCurrent will update and which one glDrawArrays will use.
Yup, that is a problem. Ideally cairo-gl should support GL and GLES2,
maybe even dlopen libGL.so or libGLESv2.so at runtime so we could
support both in one cairo build. As it is now, it's just hardcoded
full GL support. cairo-gl isn't a core dependency for wayland though,
just for the demo clients. Qt, for example, lets you select GL, GLES1
or GLES2 at compile time, which is then used for the entire stack.
Cairo gl uses glew for looking up extensions, but I think it would
make sense to just use a cairo-specific function table that would hold
the required core functions as well as the extension functions needed
by cairo. That way you can specify the GL dialect at runtime and
cairo-gl will open the right .so and lookup the necessary extension
functions for that dialect.
For the demo clients, it may be nice to move the cairo dependency out
of the toytoolkit, but even then, the toy toolkit still has to use
libGL, since otherwise it won't work with cairo-gl.
More information about the wayland-devel