Kaynağa Gözat

MIN_GL_VERSION, MIN_MESA_VERSION

David Rose 18 yıl önce
ebeveyn
işleme
93fb935b6f

+ 18 - 0
dtool/Config.pp

@@ -567,6 +567,21 @@
 // but is sometimes missing (e.g. the default FC5 installation).
 // but is sometimes missing (e.g. the default FC5 installation).
 #defer HAVE_GLU $[libtest $[GL_LPATH],$[GLU_LIBS]]
 #defer HAVE_GLU $[libtest $[GL_LPATH],$[GLU_LIBS]]
 
 
+// If you are having trouble linking in OpenGL extension functions at
+// runtime for some reason, you can set this variable.  This defines
+// the minimum runtime version of OpenGL that Panda will require.
+// Setting it to a higher version will compile in hard references to
+// the extension functions provided by that OpenGL version and below,
+// which may reduce runtime portability to other systems, but it will
+// avoid issues with getting extension function pointers.  It also, of
+// course, requires you to install the OpenGL header files and
+// compile-time libraries appropriate to the version you want to
+// compile against.
+
+// The variable is the major, minor version of OpenGL, separated by a
+// space (instead of a dot).  Thus, "1 1" means OpenGL version 1.1.
+#define MIN_GL_VERSION 1 1
+
 // Is Mesa installed separately from OpenGL?  Mesa is an open-source
 // Is Mesa installed separately from OpenGL?  Mesa is an open-source
 // software-only OpenGL renderer.  Panda can link with it
 // software-only OpenGL renderer.  Panda can link with it
 // independently from OpenGL (and if Mesa is built statically, and/or
 // independently from OpenGL (and if Mesa is built statically, and/or
@@ -598,6 +613,9 @@
 #define MESA_MGL
 #define MESA_MGL
 #defer HAVE_MESA $[libtest $[MESA_LPATH],$[MESA_LIBS]]
 #defer HAVE_MESA $[libtest $[MESA_LPATH],$[MESA_LIBS]]
 
 
+// Similar to MIN_GL_VERSION, above.
+#define MIN_MESA_VERSION 1 1
+
 
 
 // Is the Chromium remote-rendering library installed, and where?
 // Is the Chromium remote-rendering library installed, and where?
 // This should include libcr_opengl32.
 // This should include libcr_opengl32.

+ 8 - 0
dtool/LocalSetup.pp

@@ -244,6 +244,10 @@ $[cdefine HAVE_ZLIB]
 /* Define if we have OpenGL installed and want to build for GL.  */
 /* Define if we have OpenGL installed and want to build for GL.  */
 $[cdefine HAVE_GL]
 $[cdefine HAVE_GL]
 $[cdefine HAVE_GLU]
 $[cdefine HAVE_GLU]
+#if HAVE_GL
+# define MIN_GL_VERSION_MAJOR $[word 1,$[MIN_GL_VERSION]]
+# define MIN_GL_VERSION_MINOR $[word 2,$[MIN_GL_VERSION]]
+#endif
 
 
 /* Define if we have OpenCV installed and want to build for OpenCV.  */
 /* Define if we have OpenCV installed and want to build for OpenCV.  */
 $[cdefine HAVE_OPENCV]
 $[cdefine HAVE_OPENCV]
@@ -257,6 +261,10 @@ $[cdefine HAVE_ODE]
 /* Define if we have Mesa installed and want to build mesadisplay.  */
 /* Define if we have Mesa installed and want to build mesadisplay.  */
 $[cdefine HAVE_MESA]
 $[cdefine HAVE_MESA]
 $[cdefine MESA_MGL]
 $[cdefine MESA_MGL]
+#if HAVE_MESA
+# define MIN_MESA_VERSION_MAJOR $[word 1,$[MIN_MESA_VERSION]]
+# define MIN_MESA_VERSION_MINOR $[word 2,$[MIN_MESA_VERSION]]
+#endif
 
 
 /* Define if we want to build with SGI OpenGL extensions.  */
 /* Define if we want to build with SGI OpenGL extensions.  */
 $[cdefine HAVE_SGIGL]
 $[cdefine HAVE_SGIGL]

+ 24 - 0
panda/src/glgsg/glgsg.h

@@ -37,6 +37,30 @@
 #define EXPCL_GL EXPCL_PANDAGL
 #define EXPCL_GL EXPCL_PANDAGL
 #define EXPTP_GL EXPTP_PANDAGL
 #define EXPTP_GL EXPTP_PANDAGL
 
 
+#if MIN_GL_VERSION_MAJOR > 1 || (MIN_GL_VERSION_MAJOR == 1 && MIN_GL_VERSION_MINOR >= 2)
+#define EXPECT_GL_VERSION_1_2
+#endif
+
+#if MIN_GL_VERSION_MAJOR > 1 || (MIN_GL_VERSION_MAJOR == 1 && MIN_GL_VERSION_MINOR >= 3)
+#define EXPECT_GL_VERSION_1_3
+#endif
+
+#if MIN_GL_VERSION_MAJOR > 1 || (MIN_GL_VERSION_MAJOR == 1 && MIN_GL_VERSION_MINOR >= 4)
+#define EXPECT_GL_VERSION_1_4
+#endif
+
+#if MIN_GL_VERSION_MAJOR > 1 || (MIN_GL_VERSION_MAJOR == 1 && MIN_GL_VERSION_MINOR >= 5)
+#define EXPECT_GL_VERSION_1_5
+#endif
+
+#if MIN_GL_VERSION_MAJOR > 2 || (MIN_GL_VERSION_MAJOR == 2 && MIN_GL_VERSION_MINOR >= 0)
+#define EXPECT_GL_VERSION_2_0
+#endif
+
+#if MIN_GL_VERSION_MAJOR > 2 || (MIN_GL_VERSION_MAJOR == 2 && MIN_GL_VERSION_MINOR >= 1)
+#define EXPECT_GL_VERSION_2_1
+#endif
+
 // Before including gl.h, need to include windows.h
 // Before including gl.h, need to include windows.h
 #if defined(_WIN32)
 #if defined(_WIN32)
 #define WIN32_LEAN_AND_MEAN 1
 #define WIN32_LEAN_AND_MEAN 1

+ 100 - 0
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -305,8 +305,16 @@ reset() {
 
 
   if (is_at_least_version(1, 4)) {
   if (is_at_least_version(1, 4)) {
     _supports_point_parameters = true;
     _supports_point_parameters = true;
+#ifdef EXPECT_GL_VERSION_1_4
+    GLCAT.debug()
+      << "Getting compile-time PointParameter pointers\n";
+    _glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)&GLP(PointParameterfv);
+#else  // EXPECT_GL_VERSION_1_4
+    GLCAT.debug()
+      << "Getting run-time PointParameter pointers\n";
     _glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)
     _glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)
       get_extension_func(GLPREFIX_QUOTED, "PointParameterfv");
       get_extension_func(GLPREFIX_QUOTED, "PointParameterfv");
+#endif  // EXPECT_GL_VERSION_1_4
 
 
   } else if (has_extension("GL_ARB_point_parameters")) {
   } else if (has_extension("GL_ARB_point_parameters")) {
     _supports_point_parameters = true;
     _supports_point_parameters = true;
@@ -416,8 +424,16 @@ reset() {
 
 
   if (is_at_least_version(1, 2)) {
   if (is_at_least_version(1, 2)) {
     _supports_draw_range_elements = true;
     _supports_draw_range_elements = true;
+#ifdef EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting compile-time DrawRangeElements pointers\n";
+    _glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)&GLP(DrawRangeElements);
+#else  // EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting run-time DrawRangeElements pointers\n";
     _glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)
     _glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)
       get_extension_func(GLPREFIX_QUOTED, "DrawRangeElements");
       get_extension_func(GLPREFIX_QUOTED, "DrawRangeElements");
+#endif  // EXPECT_GL_VERSION_1_2
 
 
   } else if (has_extension("GL_EXT_draw_range_elements")) {
   } else if (has_extension("GL_EXT_draw_range_elements")) {
     _supports_draw_range_elements = true;
     _supports_draw_range_elements = true;
@@ -449,10 +465,19 @@ reset() {
   if (is_at_least_version(1, 2)) {
   if (is_at_least_version(1, 2)) {
     _supports_3d_texture = true;
     _supports_3d_texture = true;
 
 
+#ifdef EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting compile-time 3-D textures pointers\n";
+    _glTexImage3D = (PFNGLTEXIMAGE3DPROC)&GLP(TexImage3D);
+    _glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)&GLP(TexSubImage3D);
+#else  // EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting run-time 3-D textures pointers\n";
     _glTexImage3D = (PFNGLTEXIMAGE3DPROC)
     _glTexImage3D = (PFNGLTEXIMAGE3DPROC)
       get_extension_func(GLPREFIX_QUOTED, "TexImage3D");
       get_extension_func(GLPREFIX_QUOTED, "TexImage3D");
     _glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)
     _glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)
       get_extension_func(GLPREFIX_QUOTED, "TexSubImage3D");
       get_extension_func(GLPREFIX_QUOTED, "TexSubImage3D");
+#endif  // EXPECT_GL_VERSION_1_2
 
 
   } else if (has_extension("GL_EXT_texture3D")) {
   } else if (has_extension("GL_EXT_texture3D")) {
     _supports_3d_texture = true;
     _supports_3d_texture = true;
@@ -478,6 +503,19 @@ reset() {
   if (is_at_least_version(1, 3)) {
   if (is_at_least_version(1, 3)) {
     _supports_compressed_texture = true;
     _supports_compressed_texture = true;
 
 
+#ifdef EXPECT_GL_VERSION_1_3
+    GLCAT.debug()
+      << "Getting compile-time compressed textures pointers\n";
+    _glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)&GLP(CompressedTexImage1D);
+    _glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)&GLP(CompressedTexImage2D);
+    _glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)&GLP(CompressedTexImage3D);
+    _glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)&GLP(CompressedTexSubImage1D);
+    _glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)&GLP(CompressedTexSubImage2D);
+    _glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)&GLP(CompressedTexSubImage3D);
+    _glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)&GLP(GetCompressedTexImage);
+#else  // EXPECT_GL_VERSION_1_3
+    GLCAT.debug()
+      << "Getting run-time compressed textures pointers\n";
     _glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)
     _glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)
       get_extension_func(GLPREFIX_QUOTED, "CompressedTexImage1D");
       get_extension_func(GLPREFIX_QUOTED, "CompressedTexImage1D");
     _glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)
     _glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)
@@ -492,6 +530,7 @@ reset() {
       get_extension_func(GLPREFIX_QUOTED, "CompressedTexSubImage3D");
       get_extension_func(GLPREFIX_QUOTED, "CompressedTexSubImage3D");
     _glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)
     _glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)
       get_extension_func(GLPREFIX_QUOTED, "GetCompressedTexImage");
       get_extension_func(GLPREFIX_QUOTED, "GetCompressedTexImage");
+#endif  // EXPECT_GL_VERSION_1_3
 
 
   } else if (has_extension("GL_ARB_texture_compression")) {
   } else if (has_extension("GL_ARB_texture_compression")) {
     _supports_compressed_texture = true;
     _supports_compressed_texture = true;
@@ -586,6 +625,19 @@ reset() {
   if (is_at_least_version(1, 3)) {
   if (is_at_least_version(1, 3)) {
     _supports_multitexture = true;
     _supports_multitexture = true;
 
 
+#ifdef EXPECT_GL_VERSION_1_3
+    GLCAT.debug()
+      << "Getting compile-time multitexture pointers\n";
+    _glActiveTexture = (PFNGLACTIVETEXTUREPROC)&GLP(ActiveTexture);
+    _glClientActiveTexture = (PFNGLACTIVETEXTUREPROC)&GLP(ClientActiveTexture);
+    _glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)&GLP(MultiTexCoord1f);
+    _glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)&GLP(MultiTexCoord2f);
+    _glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)&GLP(MultiTexCoord3f);
+    _glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)&GLP(MultiTexCoord4f);
+
+#else  // EXPECT_GL_VERSION_1_3
+    GLCAT.debug() 
+      << "Getting run-time multitexture pointers\n";
     _glActiveTexture = (PFNGLACTIVETEXTUREPROC)
     _glActiveTexture = (PFNGLACTIVETEXTUREPROC)
       get_extension_func(GLPREFIX_QUOTED, "ActiveTexture");
       get_extension_func(GLPREFIX_QUOTED, "ActiveTexture");
     _glClientActiveTexture = (PFNGLACTIVETEXTUREPROC)
     _glClientActiveTexture = (PFNGLACTIVETEXTUREPROC)
@@ -598,6 +650,7 @@ reset() {
       get_extension_func(GLPREFIX_QUOTED, "MultiTexCoord3f");
       get_extension_func(GLPREFIX_QUOTED, "MultiTexCoord3f");
     _glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)
     _glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)
       get_extension_func(GLPREFIX_QUOTED, "MultiTexCoord4f");
       get_extension_func(GLPREFIX_QUOTED, "MultiTexCoord4f");
+#endif  // EXPECT_GL_VERSION_1_3
 
 
   } else if (has_extension("GL_ARB_multitexture")) {
   } else if (has_extension("GL_ARB_multitexture")) {
     _supports_multitexture = true;
     _supports_multitexture = true;
@@ -652,6 +705,17 @@ reset() {
   if (is_at_least_version(1, 5)) {
   if (is_at_least_version(1, 5)) {
     _supports_buffers = true;
     _supports_buffers = true;
 
 
+#ifdef EXPECT_GL_VERSION_1_5
+    GLCAT.debug()
+      << "Getting compile-time buffer pointers\n";
+    _glGenBuffers = (PFNGLGENBUFFERSPROC)&GLP(GenBuffers);
+    _glBindBuffer = (PFNGLBINDBUFFERPROC)&GLP(BindBuffer);
+    _glBufferData = (PFNGLBUFFERDATAPROC)&GLP(BufferData);
+    _glBufferSubData = (PFNGLBUFFERSUBDATAPROC)&GLP(BufferSubData);
+    _glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)&GLP(DeleteBuffers);
+#else  // EXPECT_GL_VERSION_1_5
+    GLCAT.debug()
+      << "Getting run-time buffer pointers\n";
     _glGenBuffers = (PFNGLGENBUFFERSPROC)
     _glGenBuffers = (PFNGLGENBUFFERSPROC)
       get_extension_func(GLPREFIX_QUOTED, "GenBuffers");
       get_extension_func(GLPREFIX_QUOTED, "GenBuffers");
     _glBindBuffer = (PFNGLBINDBUFFERPROC)
     _glBindBuffer = (PFNGLBINDBUFFERPROC)
@@ -662,6 +726,7 @@ reset() {
       get_extension_func(GLPREFIX_QUOTED, "BufferSubData");
       get_extension_func(GLPREFIX_QUOTED, "BufferSubData");
     _glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)
     _glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)
       get_extension_func(GLPREFIX_QUOTED, "DeleteBuffers");
       get_extension_func(GLPREFIX_QUOTED, "DeleteBuffers");
+#endif  // EXPECT_GL_VERSION_1_5
 
 
   } else if (has_extension("GL_ARB_vertex_buffer_object")) {
   } else if (has_extension("GL_ARB_vertex_buffer_object")) {
     _supports_buffers = true;
     _supports_buffers = true;
@@ -770,6 +835,20 @@ reset() {
   if (CLP(support_occlusion_query)) {
   if (CLP(support_occlusion_query)) {
     if (is_at_least_version(1, 5)) {
     if (is_at_least_version(1, 5)) {
       _supports_occlusion_query = true;
       _supports_occlusion_query = true;
+
+#ifdef EXPECT_GL_VERSION_1_5
+      GLCAT.debug()
+        << "Getting compile-time occlusion pointers\n";
+      _glGenQueries = (PFNGLGENQUERIESPROC)&GLP(GenQueries);
+      _glBeginQuery = (PFNGLBEGINQUERYPROC)&GLP(BeginQuery);
+      _glEndQuery = (PFNGLENDQUERYPROC)&GLP(EndQuery);
+      _glDeleteQueries = (PFNGLDELETEQUERIESPROC)&GLP(DeleteQueries);
+      _glGetQueryiv = (PFNGLGETQUERYIVPROC)&GLP(GetQueryiv);
+      _glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)&GLP(GetQueryObjectuiv);
+
+#else  // EXPECT_GL_VERSION_1_5
+      GLCAT.debug()
+        << "Getting run-time occlusion pointers\n";
       _glGenQueries = (PFNGLGENQUERIESPROC)
       _glGenQueries = (PFNGLGENQUERIESPROC)
         get_extension_func(GLPREFIX_QUOTED, "GenQueries");
         get_extension_func(GLPREFIX_QUOTED, "GenQueries");
       _glBeginQuery = (PFNGLBEGINQUERYPROC)
       _glBeginQuery = (PFNGLBEGINQUERYPROC)
@@ -782,6 +861,8 @@ reset() {
         get_extension_func(GLPREFIX_QUOTED, "GetQueryiv");
         get_extension_func(GLPREFIX_QUOTED, "GetQueryiv");
       _glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)
       _glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)
         get_extension_func(GLPREFIX_QUOTED, "GetQueryObjectuiv");
         get_extension_func(GLPREFIX_QUOTED, "GetQueryObjectuiv");
+#endif  // EXPECT_GL_VERSION_1_5
+
     } else if (has_extension("GL_ARB_occlusion_query")) {
     } else if (has_extension("GL_ARB_occlusion_query")) {
       _supports_occlusion_query = true;
       _supports_occlusion_query = true;
       _glGenQueries = (PFNGLGENQUERIESPROC)
       _glGenQueries = (PFNGLGENQUERIESPROC)
@@ -823,8 +904,16 @@ reset() {
   bool supports_blend_equation = false;
   bool supports_blend_equation = false;
   if (is_at_least_version(1, 2)) {
   if (is_at_least_version(1, 2)) {
     supports_blend_equation = true;
     supports_blend_equation = true;
+#ifdef EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting compile-time BlendEquation pointers\n";
+    _glBlendEquation = (PFNGLBLENDEQUATIONPROC)&GLP(BlendEquation);
+#else  // EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting run-time blend pointers\n";
     _glBlendEquation = (PFNGLBLENDEQUATIONPROC)
     _glBlendEquation = (PFNGLBLENDEQUATIONPROC)
       get_extension_func(GLPREFIX_QUOTED, "BlendEquation");
       get_extension_func(GLPREFIX_QUOTED, "BlendEquation");
+#endif  // EXPECT_GL_VERSION_1_2
   } else if (has_extension("GL_EXT_blend_minmax")) {
   } else if (has_extension("GL_EXT_blend_minmax")) {
     supports_blend_equation = true;
     supports_blend_equation = true;
     _glBlendEquation = (PFNGLBLENDEQUATIONPROC)
     _glBlendEquation = (PFNGLBLENDEQUATIONPROC)
@@ -842,8 +931,16 @@ reset() {
   bool supports_blend_color = false;
   bool supports_blend_color = false;
   if (is_at_least_version(1, 2)) {
   if (is_at_least_version(1, 2)) {
     supports_blend_color = true;
     supports_blend_color = true;
+#ifdef EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting compile-time BlendColor pointers\n";
+    _glBlendColor = (PFNGLBLENDCOLORPROC)&GLP(BlendColor);
+#else  // EXPECT_GL_VERSION_1_2
+    GLCAT.debug()
+      << "Getting run-time BlendColor pointers\n";
     _glBlendColor = (PFNGLBLENDCOLORPROC)
     _glBlendColor = (PFNGLBLENDCOLORPROC)
       get_extension_func(GLPREFIX_QUOTED, "BlendColor");
       get_extension_func(GLPREFIX_QUOTED, "BlendColor");
+#endif  // EXPECT_GL_VERSION_1_2
   } else if (has_extension("GL_EXT_blend_color")) {
   } else if (has_extension("GL_EXT_blend_color")) {
     supports_blend_color = true;
     supports_blend_color = true;
     _glBlendColor = (PFNGLBLENDCOLORPROC)
     _glBlendColor = (PFNGLBLENDCOLORPROC)
@@ -1208,11 +1305,14 @@ reset() {
   vertex_profile = cgGLGetLatestProfile (CG_GL_VERTEX);
   vertex_profile = cgGLGetLatestProfile (CG_GL_VERTEX);
   pixel_profile = cgGLGetLatestProfile (CG_GL_FRAGMENT);
   pixel_profile = cgGLGetLatestProfile (CG_GL_FRAGMENT);
   if (GLCAT.is_debug()) {
   if (GLCAT.is_debug()) {
+    // Temp ifdef: this crashes Mesa.
+#ifndef OSMESA_MAJOR_VERSION
     GLCAT.debug()
     GLCAT.debug()
       << "\nCg vertex profile = " << cgGetProfileString(vertex_profile) << "  id = " << vertex_profile
       << "\nCg vertex profile = " << cgGetProfileString(vertex_profile) << "  id = " << vertex_profile
       << "\nCg pixel profile = " << cgGetProfileString(pixel_profile) << "  id = " << pixel_profile
       << "\nCg pixel profile = " << cgGetProfileString(pixel_profile) << "  id = " << pixel_profile
       << "\nshader model = " << _shader_model
       << "\nshader model = " << _shader_model
       << "\n";
       << "\n";
+#endif
   }
   }
 
 
 #endif
 #endif

+ 24 - 0
panda/src/mesadisplay/mesagsg.h

@@ -44,6 +44,30 @@
 #define EXPCL_GL EXPCL_PANDAMESA
 #define EXPCL_GL EXPCL_PANDAMESA
 #define EXPTP_GL EXPTP_PANDAMESA
 #define EXPTP_GL EXPTP_PANDAMESA
 
 
+#if MIN_MESA_VERSION_MAJOR > 1 || (MIN_MESA_VERSION_MAJOR == 1 && MIN_MESA_VERSION_MINOR >= 2)
+#define EXPECT_GL_VERSION_1_2
+#endif
+
+#if MIN_MESA_VERSION_MAJOR > 1 || (MIN_MESA_VERSION_MAJOR == 1 && MIN_MESA_VERSION_MINOR >= 3)
+#define EXPECT_GL_VERSION_1_3
+#endif
+
+#if MIN_MESA_VERSION_MAJOR > 1 || (MIN_MESA_VERSION_MAJOR == 1 && MIN_MESA_VERSION_MINOR >= 4)
+#define EXPECT_GL_VERSION_1_4
+#endif
+
+#if MIN_MESA_VERSION_MAJOR > 1 || (MIN_MESA_VERSION_MAJOR == 1 && MIN_MESA_VERSION_MINOR >= 5)
+#define EXPECT_GL_VERSION_1_5
+#endif
+
+#if MIN_MESA_VERSION_MAJOR > 2 || (MIN_MESA_VERSION_MAJOR == 2 && MIN_MESA_VERSION_MINOR >= 0)
+#define EXPECT_GL_VERSION_2_0
+#endif
+
+#if MIN_MESA_VERSION_MAJOR > 2 || (MIN_MESA_VERSION_MAJOR == 2 && MIN_MESA_VERSION_MINOR >= 1)
+#define EXPECT_GL_VERSION_2_1
+#endif
+
 // This prevents glext.h from getting included by gl.h
 // This prevents glext.h from getting included by gl.h
 // That way, we can provide our own, better version.
 // That way, we can provide our own, better version.
 #define __glext_h_
 #define __glext_h_

+ 2 - 2
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx

@@ -80,7 +80,7 @@ get_extension_func(const char *prefix, const char *name) {
   }
   }
   if (ptr == (void *)NULL) {
   if (ptr == (void *)NULL) {
     // Well, try for the more accurate name.
     // Well, try for the more accurate name.
-    fullname = string(prefix) + name;
+    fullname = string(prefix) + string(name);
     ptr = (void *)OSMesaGetProcAddress(fullname.c_str());
     ptr = (void *)OSMesaGetProcAddress(fullname.c_str());
     if (mesadisplay_cat.is_debug()) {
     if (mesadisplay_cat.is_debug()) {
       mesadisplay_cat.debug()
       mesadisplay_cat.debug()
@@ -93,7 +93,7 @@ get_extension_func(const char *prefix, const char *name) {
 #else
 #else
   if (mesadisplay_cat.is_debug()) {
   if (mesadisplay_cat.is_debug()) {
     mesadisplay_cat.debug()
     mesadisplay_cat.debug()
-      << "Couldn't look up extension function: compied with Mesa version "
+      << "Couldn't look up extension function: compiled with Mesa version "
       << OSMESA_MAJOR_VERSION << "." << OSMESA_MINOR_VERSION << "\n";
       << OSMESA_MAJOR_VERSION << "." << OSMESA_MINOR_VERSION << "\n";
   }
   }