[Mesa-users] Linking OSMesa and GL

Frédéric Devernay frederic.devernay at inria.fr
Tue Aug 9 20:06:34 UTC 2016


Since most OSMesa functions and libGL functions have the same name, the first one on the command-line will take precedence.

You have two options:
- link both libraries, but use a mangled OSMesa (and a mangled GLU if you're using GLU). Mangled OSMesa can be linked statically in this case. You can the either called the mangled OSMesa functions directly (mgl... instead of gl...), or use OSMesaGetProcAddress to get the entry points and store them in pointers to functions which you use in your OpenGL code.
- open the non-mangled OSMesa library from your program using dlopen() (on Unix), and get the entry point for OSMesaGetProcAddress using dlsym(), and then get the various OpenGL entry points using OSMesaGetProcAddress. You cannot use GLU in this case (because GLU calls the OpenGL functions directly), except if the OSMesa is mangled, in which cas you can use a mangled GLU.

I have a script which installs a static osmesa (mangled or not) with the driver of your choice and a few patches for mesa 11.1-12.0 at https://github.com/devernay/osmesa-install
Frédéric Devernay, Research Scientist, INRIA
frederic.devernay at inria.fr

> Le 9 août 2016 à 20:25, Haavard Holm <haavard.holm at ntnu.no> a écrit :
> Hello,
> I have made a program, running under fltk and using the GL-libraries.
> To add some features it seems handy to use OSMesa. I have however problems using both libraries.
> If I link with -lOSMesa -lGL -lGLU, my OSMesa features work fine, but my other OpenGL windows turn black.
> If I link with -lGL -lGLU -lOSMesa, gives the oposite result.
> How can this be fixed ? Are there a way to handle this problem ?
> Best regards
> Håvard Holm
> _______________________________________________
> mesa-users mailing list
> mesa-users at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-users

More information about the mesa-users mailing list