Created two PixelBufferX11::closeImplementation() one the real implementation and

a second non op one for GLX <1.3.
This commit is contained in:
Robert Osfield
2007-09-13 09:30:30 +00:00
parent 45e98d5f18
commit 0f135d6d35

View File

@@ -267,6 +267,47 @@ void PixelBufferX11::init()
_initialized = true;
}
void PixelBufferX11::closeImplementation()
{
// osg::notify(osg::NOTICE)<<"Closing PixelBufferX11"<<std::endl;
if (_display)
{
if (_glxContext)
{
glXDestroyContext(_display, _glxContext );
}
if (_pbuffer)
{
glXDestroyPbuffer(_display, _pbuffer);
}
XFlush( _display );
XSync( _display,0 );
}
_pbuffer = 0;
_parent = 0;
_glxContext = 0;
if (_visualInfo)
{
XFree(_visualInfo);
_visualInfo = 0;
}
if (_display)
{
XCloseDisplay( _display );
_display = 0;
}
_initialized = false;
_realized = false;
_valid = false;
}
#else
// fallback for non GLX1.3 versions where pbuffers are not supported.
@@ -280,6 +321,17 @@ void PixelBufferX11::init()
{
}
void PixelBufferX11::closeImplementation()
{
// osg::notify(osg::NOTICE)<<"Closing PixelBufferX11"<<std::endl;
_pbuffer = 0;
_parent = 0;
_glxContext = 0;
_initialized = false;
_realized = false;
_valid = false;
}
#endif
bool PixelBufferX11::realizeImplementation()
@@ -340,48 +392,6 @@ void PixelBufferX11::bindPBufferToTextureImplementation(GLenum buffer)
osg::notify(osg::NOTICE)<<"PixelBufferX11::bindPBufferToTextureImplementation() not implementation yet."<<std::endl;
}
void PixelBufferX11::closeImplementation()
{
// osg::notify(osg::NOTICE)<<"Closing PixelBufferX11"<<std::endl;
if (_display)
{
if (_glxContext)
{
glXDestroyContext(_display, _glxContext );
}
if (_pbuffer)
{
glXDestroyPbuffer(_display, _pbuffer);
}
XFlush( _display );
XSync( _display,0 );
}
_pbuffer = 0;
_parent = 0;
_glxContext = 0;
if (_visualInfo)
{
XFree(_visualInfo);
_visualInfo = 0;
}
if (_display)
{
XCloseDisplay( _display );
_display = 0;
}
_initialized = false;
_realized = false;
_valid = false;
}
void PixelBufferX11::swapBuffersImplementation()
{
if (!_realized) return;