which library should OpenGL ES clients link to?

Chia-I Wu olvaffe at gmail.com
Wed Nov 10 06:36:45 PST 2010

2010/11/10 Kristian Høgsberg <krh at bitplanet.net>:
> 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.
Yeah.  Even cairo-gl supports both GL and GLES2 and load libGL.so or
libGLESv2.so at runtime, it might still not be robust.  What cairo-gl
loads and what an app links to can still differ.

The idea I have is to _not_ distribute libGLESv1_CM.so and
libGLESv2.so at all on systems with libGL.so.  An app or a library
that uses GLES2 should always link to libGL.so and use
eglGetProcAddress to find the addresses of the GLES2 functions.

olv at LunarG.com

More information about the wayland-devel mailing list