diff --git a/dtool/Config.pp b/dtool/Config.pp index 2c9ce612f3..54c6c1f162 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -273,6 +273,38 @@ #endif #defer HAVE_GL $[libtest $[GL_LPATH],$[GL_LIBS]] +// Is Mesa installed separately from OpenGL? Mesa is an open-source +// software-only OpenGL renderer. Panda can link with it +// independently from OpenGL (and if Mesa is built statically, and/or +// with -DUSE_MGL_NAMESPACE declared to rename gl* to mgl*, it can +// switch between the system OpenGL implementation and the Mesa +// implementation at runtime). + +// Also, Mesa includes some core libraries (in libOSMesa.so) that +// allow totally headless rendering, handy if you want to run a +// renderer as a batch service, and you don't want to insist that a +// user be logged on to the desktop or otherwise deal with X11 or +// Windows. + +// If you define HAVE_MESA here, and the appropriate paths to headers +// and libraries, then Panda will build libmesadisplay, which can be +// used in lieu of libpandagl or libpandadx to do rendering. However, +// for most applications, you don't need to do this, since (a) if you +// have hardware rendering capability, you probably don't want to use +// Mesa, since it's software-only, and (b) if you don't have hardware +// rendering, you can install Mesa as the system's OpenGL +// implementation, so you can just use the normal libpandagl. You +// only need to define HAVE_MESA if you want to run totally headless, +// or if you want to be able to easily switch between Mesa and the +// system OpenGL implementation at runtime. If you compiled Mesa with +// USE_MGL_NAMESPACE defined, define it also here. +#define MESA_IPATH +#define MESA_LPATH +#define MESA_LIBS +#define USE_MGL_NAMESPACE +#defer HAVE_MESA $[libtest $[MESA_LPATH],$[MESA_LIBS]] + + // Is Chromium OpenGL installed, and where? This should include libcr_opengl32. #defer CHROMIUM_IPATH #defer CHROMIUM_LPATH /usr/X11R6/lib diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index 9c5ef2f6ca..1280b9ed63 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -67,6 +67,10 @@ $[cdefine HAVE_ZLIB] /* Define if we have OpenGL installed and want to build for GL. */ $[cdefine HAVE_GL] +/* Define if we have Mesa installed and want to build mesadisplay. */ +$[cdefine HAVE_MESA] +$[cdefine USE_MGL_NAMESPACE] + /* Define if we want to build with SGI OpenGL extensions. */ $[cdefine HAVE_SGIGL] diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index f56be639b9..53706b249f 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -125,6 +125,13 @@ #define gl_libs $[GL_LIBS] #endif +#if $[HAVE_MESA] + #define mesa_ipath $[wildcard $[MESA_IPATH]] + #define mesa_lpath $[wildcard $[MESA_LPATH]] + #define mesa_cflags $[MESA_CFLAGS] + #define mesa_libs $[MESA_LIBS] +#endif + #if $[HAVE_CHROMIUM] #define chromium_ipath $[wildcard $[CHROMIUM_IPATH]] #define chromium_lpath $[wildcard $[CHROMIUM_LPATH]]