From Andy Skinner, "Someone was using our code on a system that does not seem to have the SGIX symbols used in osgViewer.cpp.
I used osgSetGLExtensionsFuncPtr to remove the symbols. I don't know how to test this path, but it did remove the symbols from libosgViewer.so. I have also not been able yet to see if that was sufficient for our customer. I did this by looking at other cases, and I tried to follow some of the same practices in PixelBufferX11, like using _useSGIX in a similar way to the previous _useGLX1_3." git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15042 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
e9b75e0ded
commit
5e8d5b50db
@ -83,6 +83,17 @@ class OSGVIEWER_EXPORT PixelBufferX11 : public osg::GraphicsContext, public osgV
|
||||
bool _realized;
|
||||
|
||||
bool _useGLX1_3;
|
||||
bool _useSGIX;
|
||||
|
||||
typedef Pbuffer ( *GLXCreateGLXPbufferSGIX_FuncPtr) (Display *dpy, GLXFBConfig config, unsigned int, unsigned height, int* attrib_list);
|
||||
typedef void ( *GLXDestroyGLXPbufferSGIX_FuncPtr) (Display *dpy, Pbuffer pbuf);
|
||||
typedef int ( *GLXQueryGLXPbufferSGIX_FuncCPtr) (Display *dpy, Pbuffer pbuf, int attribute, unsigned int *value);
|
||||
typedef GLXFBConfig ( *GLXGetFBConfigFromVisualSGIX_FuncPtr) (Display *dpy, XVisualInfo *vis);
|
||||
|
||||
GLXCreateGLXPbufferSGIX_FuncPtr _glXCreateGLXPbufferSGIX;
|
||||
GLXDestroyGLXPbufferSGIX_FuncPtr _glXDestroyGLXPbufferSGIX;
|
||||
GLXQueryGLXPbufferSGIX_FuncCPtr _glXQueryGLXPbufferSGIX;
|
||||
GLXGetFBConfigFromVisualSGIX_FuncPtr _glXGetFBConfigFromVisualSGIX;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,12 @@ PixelBufferX11::PixelBufferX11(osg::GraphicsContext::Traits* traits)
|
||||
_visualInfo(0),
|
||||
_initialized(false),
|
||||
_realized(false),
|
||||
_useGLX1_3(false)
|
||||
_useGLX1_3(false),
|
||||
_useSGIX(false),
|
||||
_glXCreateGLXPbufferSGIX(NULL),
|
||||
_glXDestroyGLXPbufferSGIX(NULL),
|
||||
_glXQueryGLXPbufferSGIX(NULL),
|
||||
_glXGetFBConfigFromVisualSGIX(NULL)
|
||||
{
|
||||
_traits = traits;
|
||||
|
||||
@ -181,6 +186,20 @@ void PixelBufferX11::init()
|
||||
const char *extensions = glXQueryExtensionsString(_display, screen);
|
||||
haveSGIX_pbuffer = osg::isExtensionInExtensionString("GLX_SGIX_pbuffer", extensions)
|
||||
&& osg::isExtensionInExtensionString("GLX_SGIX_fbconfig", extensions);
|
||||
|
||||
if (haveSGIX_pbuffer)
|
||||
{
|
||||
osg::setGLExtensionFuncPtr(_glXCreateGLXPbufferSGIX, "glXDestroyGLXPbufferSGIX");
|
||||
osg::setGLExtensionFuncPtr(_glXDestroyGLXPbufferSGIX, "glXDestroyGLXPbufferSGIX");
|
||||
osg::setGLExtensionFuncPtr(_glXQueryGLXPbufferSGIX, "glXDestroyGLXPbufferSGIX");
|
||||
osg::setGLExtensionFuncPtr(_glXGetFBConfigFromVisualSGIX, "glXGetFBConfigFromVisualSGIX");
|
||||
if (_glXCreateGLXPbufferSGIX == NULL ||
|
||||
_glXDestroyGLXPbufferSGIX == NULL ||
|
||||
_glXQueryGLXPbufferSGIX == NULL ||
|
||||
_glXGetFBConfigFromVisualSGIX == NULL) {
|
||||
haveSGIX_pbuffer = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -283,7 +302,7 @@ void PixelBufferX11::init()
|
||||
// If we still have no pbuffer but a capable display with the SGIX extension, try to use that
|
||||
if (!_pbuffer && haveSGIX_pbuffer)
|
||||
{
|
||||
GLXFBConfigSGIX fbconfig = glXGetFBConfigFromVisualSGIX( _display, _visualInfo );
|
||||
GLXFBConfigSGIX fbconfig = _glXGetFBConfigFromVisualSGIX( _display, _visualInfo );
|
||||
typedef std::vector <int> AttributeList;
|
||||
|
||||
AttributeList attributes;
|
||||
@ -291,14 +310,15 @@ void PixelBufferX11::init()
|
||||
attributes.push_back( GL_TRUE );
|
||||
attributes.push_back( 0L );
|
||||
|
||||
_pbuffer = glXCreateGLXPbufferSGIX(_display, fbconfig, _traits->width, _traits->height, &attributes.front() );
|
||||
_pbuffer = _glXCreateGLXPbufferSGIX(_display, fbconfig, _traits->width, _traits->height, &attributes.front() );
|
||||
if (_pbuffer)
|
||||
{
|
||||
_useSGIX = true;
|
||||
int iWidth = 0;
|
||||
int iHeight = 0;
|
||||
glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_WIDTH_SGIX , (unsigned int *)&iWidth);
|
||||
glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_HEIGHT_SGIX, (unsigned int *)&iHeight);
|
||||
|
||||
_glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_WIDTH_SGIX , (unsigned int *)&iWidth);
|
||||
_glXQueryGLXPbufferSGIX(_display, _pbuffer, GLX_HEIGHT_SGIX, (unsigned int *)&iHeight);
|
||||
|
||||
if (_traits->width != iWidth || _traits->height != iHeight)
|
||||
{
|
||||
OSG_NOTICE << "PixelBufferX11::init(), SGIX_pbuffer created with different size then requsted" << std::endl;
|
||||
@ -351,7 +371,10 @@ void PixelBufferX11::closeImplementation()
|
||||
else
|
||||
{
|
||||
#ifdef GLX_SGIX_pbuffer
|
||||
glXDestroyGLXPbufferSGIX(_display, _pbuffer);
|
||||
if (_useSGIX)
|
||||
{
|
||||
_glXDestroyGLXPbufferSGIX(_display, _pbuffer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user