浏览代码

refine HAVE_MESA

David Rose 22 年之前
父节点
当前提交
c2778d8716
共有 3 个文件被更改,包括 43 次插入0 次删除
  1. 32 0
      dtool/Config.pp
  2. 4 0
      dtool/LocalSetup.pp
  3. 7 0
      dtool/pptempl/Global.pp

+ 32 - 0
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

+ 4 - 0
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]
 

+ 7 - 0
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]]