From 3f0bcc956804737f47cedf02cd4bc07cec6b0718 Mon Sep 17 00:00:00 2001 From: ehofman Date: Wed, 14 Dec 2005 10:28:16 +0000 Subject: [PATCH] =?utf8?q?Mathias=20Fr=F6hlich:?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Detect whether we support pubuffers at runtime using the GLX extension string. Erik: Add support to compile TestRenderTexture if GLUT is installed. --- configure.ac | 3 +++ simgear/screen/Makefile.am | 13 ++++++++++++- simgear/screen/RenderTexture.cpp | 16 ++++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d557a5fa..d50e2bb2 100644 --- a/configure.ac +++ b/configure.ac @@ -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" diff --git a/simgear/screen/Makefile.am b/simgear/screen/Makefile.am index 155d1fe4..482bba61 100644 --- a/simgear/screen/Makefile.am +++ b/simgear/screen/Makefile.am @@ -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 diff --git a/simgear/screen/RenderTexture.cpp b/simgear/screen/RenderTexture.cpp index d16be9fd..5bcbe322 100644 --- a/simgear/screen/RenderTexture.cpp +++ b/simgear/screen/RenderTexture.cpp @@ -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 && -- 2.39.5