Mathias Fröhlich:
Detect whether we support pubuffers at runtime using the GLX extension string. Erik: Add support to compile TestRenderTexture if GLUT is installed.
This commit is contained in:
@@ -250,6 +250,9 @@ case "${host}" in
|
|||||||
|
|
||||||
esac
|
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"
|
opengl_LIBS="$LIBS"
|
||||||
LIBS="$base_LIBS"
|
LIBS="$base_LIBS"
|
||||||
|
|
||||||
|
|||||||
@@ -35,4 +35,15 @@ libsgscreen_a_SOURCES = \
|
|||||||
shader.cpp \
|
shader.cpp \
|
||||||
win32-printer.h
|
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
|
||||||
|
|||||||
@@ -1792,7 +1792,8 @@ bool RenderTexture::_VerifyExtensions()
|
|||||||
PrintExtensionError("GL_NV_texture_rectangle");
|
PrintExtensionError("GL_NV_texture_rectangle");
|
||||||
return false;
|
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");
|
PrintExtensionError("GL_NV_float_buffer or GL_ATI_pixel_format_float");
|
||||||
return false;
|
return false;
|
||||||
@@ -1820,6 +1821,16 @@ bool RenderTexture::_VerifyExtensions()
|
|||||||
}
|
}
|
||||||
#elif defined( __APPLE__ )
|
#elif defined( __APPLE__ )
|
||||||
#else
|
#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.
|
// First try the glX version 1.3 functions.
|
||||||
glXChooseFBConfigPtr = (glXChooseFBConfigProc)SGLookupFunction("glXChooseFBConfig");
|
glXChooseFBConfigPtr = (glXChooseFBConfigProc)SGLookupFunction("glXChooseFBConfig");
|
||||||
@@ -1829,7 +1840,8 @@ bool RenderTexture::_VerifyExtensions()
|
|||||||
glXDestroyPbufferPtr = (glXDestroyPbufferProc)SGLookupFunction("glXDestroyPbuffer");
|
glXDestroyPbufferPtr = (glXDestroyPbufferProc)SGLookupFunction("glXDestroyPbuffer");
|
||||||
glXQueryDrawablePtr = (glXQueryDrawableProc)SGLookupFunction("glXQueryDrawable");
|
glXQueryDrawablePtr = (glXQueryDrawableProc)SGLookupFunction("glXQueryDrawable");
|
||||||
|
|
||||||
if (glXChooseFBConfigPtr &&
|
if (((1 <= major && 3 <= minor) || 2 <= major) &&
|
||||||
|
glXChooseFBConfigPtr &&
|
||||||
glXCreatePbufferPtr &&
|
glXCreatePbufferPtr &&
|
||||||
glXGetVisualFromFBConfigPtr &&
|
glXGetVisualFromFBConfigPtr &&
|
||||||
glXCreateContextPtr &&
|
glXCreateContextPtr &&
|
||||||
|
|||||||
Reference in New Issue
Block a user