]> git.mxchange.org Git - simgear.git/commitdiff
Mathias Fröhlich:
authorehofman <ehofman>
Wed, 14 Dec 2005 10:28:16 +0000 (10:28 +0000)
committerehofman <ehofman>
Wed, 14 Dec 2005 10:28:16 +0000 (10:28 +0000)
Detect whether we support pubuffers at runtime using the GLX extension string.

Erik:

Add support to compile TestRenderTexture if GLUT is installed.

configure.ac
simgear/screen/Makefile.am
simgear/screen/RenderTexture.cpp

index d557a5fa7d474ce483d173615e644f79f211d808..d50e2bb218e8350d59fc115e4dab5438f0ef4bc9 100644 (file)
@@ -250,6 +250,9 @@ case "${host}" in
 
 esac
 
+AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
+AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
+
 opengl_LIBS="$LIBS"
 LIBS="$base_LIBS"
 
index 155d1fe495a226284a9f9f6316d331d46fde18d2..482bba619cb8ffb2945712e8069578d3332b3095 100644 (file)
@@ -35,4 +35,15 @@ libsgscreen_a_SOURCES = \
        shader.cpp \
        win32-printer.h
 
-INCLUDES = -I$(top_srcdir) -DGLX_GLXEXT_PROTOTYPES
+if HAVE_GLUT
+noinst_PROGRAMS = TestRenderTexture
+
+TestRenderTexture_SOURCES = TestRenderTexture.cpp
+
+TestRenderTexture_LDADD = \
+       $(top_builddir)/simgear/screen/libsgscreen.a \
+       $(top_builddir)/simgear/debug/libsgdebug.a \
+       $(opengl_LIBS)
+endif
+
+INCLUDES = -I$(top_srcdir) -I$(top_builddir) -DGLX_GLXEXT_PROTOTYPES
index d16be9fd4504b0e4d74897c7ede70986d8c94249..5bcbe32245190efd1e94e4ea8b2df61002a7f64c 100644 (file)
@@ -1792,7 +1792,8 @@ bool RenderTexture::_VerifyExtensions()
             PrintExtensionError("GL_NV_texture_rectangle");
             return false;
         }
-        if (_bFloat && !(SGIsOpenGLExtensionSupported( "GL_NV_float_buffer" ) || SGSearchExtensionsString( wglExtensionsString.c_str(), "WGL_ATI_pixel_format_float" )))
+        if (_bFloat && !(SGIsOpenGLExtensionSupported( "GL_NV_float_buffer" ) ||
+            SGSearchExtensionsString( wglExtensionsString.c_str(), "WGL_ATI_pixel_format_float" )))
         {
             PrintExtensionError("GL_NV_float_buffer or GL_ATI_pixel_format_float");
             return false;
@@ -1820,6 +1821,16 @@ bool RenderTexture::_VerifyExtensions()
     }
 #elif defined( __APPLE__ )
 #else
+    Display* dpy = glXGetCurrentDisplay();
+    int minor = 0, major = 0;
+    if (!glXQueryVersion(dpy, &major, &minor))
+        return false;
+
+    int screen = DefaultScreen(dpy);
+    const char* extString = glXQueryExtensionsString(dpy, screen);
+    if (!SGSearchExtensionsString(extString, "GLX_SGIX_fbconfig") ||
+        !SGSearchExtensionsString(extString, "GLX_SGIX_pbuffer"))
+        return false;
 
     // First try the glX version 1.3 functions.
     glXChooseFBConfigPtr = (glXChooseFBConfigProc)SGLookupFunction("glXChooseFBConfig");
@@ -1829,7 +1840,8 @@ bool RenderTexture::_VerifyExtensions()
     glXDestroyPbufferPtr = (glXDestroyPbufferProc)SGLookupFunction("glXDestroyPbuffer");
     glXQueryDrawablePtr = (glXQueryDrawableProc)SGLookupFunction("glXQueryDrawable");
 
-    if (glXChooseFBConfigPtr &&
+    if (((1 <= major && 3 <= minor) || 2 <= major) &&
+        glXChooseFBConfigPtr &&
         glXCreatePbufferPtr &&
         glXGetVisualFromFBConfigPtr &&
         glXCreateContextPtr &&