From Laurens Voerman, "Wile working with pbuffers I noticed that the Win32 implementation uses the attribute WGL_PBUFFER_LARGEST_ARB.

> quote from http://www.opengl.org/registry/specs/ARB/wgl_pbuffer.txt
>    The following attributes are supported by wglCreatePbufferARB:
>
>      WGL_PBUFFER_LARGEST_ARB     If this attribute is set to a
>                                  non-zero value, the largest
>                                  available pbuffer is allocated
>                                  when the allocation of the pbuffer
>                                  would otherwise fail due to
>                                  insufficient resources.  The width
>                                  or height of the allocated pbuffer
>                                  never exceeds <iWidth> and <iHeight>,
>                                  respectively.  Use wglQueryPbufferARB
>                                  to retrieve the dimensions of the
>                                  allocated pbuffer.

It notifies the user when the size is not as requested, but I could find no way for the program to detect this. I've added two lines to write the new size back into the _traits, I think this is appropriate, but I am not absolutely sure.

In PixelBufferX11 was no support, so I've added GLX_LARGEST_PBUFFER(_SGIX) support, with the same writeback to the _trais.


I have tested the GLX_LARGEST_PBUFFER version on linux and the WGL_PBUFFER_LARGEST_ARB with windows, all tested with the modified autocapture I just submitted.


"autocapture --pbuffer --window 100 100 18192 18192 cow.osg.\[0,0,-22.7\].trans"
gives me a 4096x4096 image on my windows machine,
and a 8192x8192 image on linux."
This commit is contained in:
Robert Osfield
2010-01-26 17:04:55 +00:00
parent bad5a4d43a
commit 306f45fbf2
2 changed files with 43 additions and 3 deletions

View File

@@ -632,6 +632,8 @@ void PixelBufferWin32::init()
osg::notify(osg::NOTICE) << "PixelBufferWin32::init(), pbuffer created with different size then requsted" << std::endl;
osg::notify(osg::NOTICE) << "\tRequested size (" << _traits->width << "," << _traits->height << ")" << std::endl;
osg::notify(osg::NOTICE) << "\tPbuffer size (" << iWidth << "," << iHeight << ")" << std::endl;
_traits->width = iWidth;
_traits->height = iHeight;
}
_initialized = true;

View File

@@ -250,6 +250,8 @@ void PixelBufferX11::init()
attributes.push_back( _traits->width );
attributes.push_back( GLX_PBUFFER_HEIGHT );
attributes.push_back( _traits->height );
attributes.push_back( GLX_LARGEST_PBUFFER );
attributes.push_back( GL_TRUE );
attributes.push_back( 0L );
_pbuffer = glXCreatePbuffer(_display, fbconfigs[i], &attributes.front() );
@@ -257,7 +259,22 @@ void PixelBufferX11::init()
}
}
}
if (_pbuffer)
{
int iWidth = 0;
int iHeight = 0;
glXQueryDrawable(_display, _pbuffer, GLX_WIDTH , (unsigned int *)&iWidth);
glXQueryDrawable(_display, _pbuffer, GLX_HEIGHT , (unsigned int *)&iHeight);
if (_traits->width != iWidth || _traits->height != iHeight)
{
osg::notify(osg::NOTICE) << "PixelBufferX11::init(), pbuffer created with different size then requsted" << std::endl;
osg::notify(osg::NOTICE) << "\tRequested size (" << _traits->width << "," << _traits->height << ")" << std::endl;
osg::notify(osg::NOTICE) << "\tPbuffer size (" << iWidth << "," << iHeight << ")" << std::endl;
_traits->width = iWidth;
_traits->height = iHeight;
}
}
XFree( fbconfigs );
}
#endif
@@ -267,9 +284,30 @@ void PixelBufferX11::init()
if (!_pbuffer && haveSGIX_pbuffer)
{
GLXFBConfigSGIX fbconfig = glXGetFBConfigFromVisualSGIX( _display, _visualInfo );
_pbuffer = glXCreateGLXPbufferSGIX(_display, fbconfig, _traits->width, _traits->height, 0 );
typedef std::vector <int> AttributeList;
AttributeList attributes;
attributes.push_back( GLX_LARGEST_PBUFFER_SGIX );
attributes.push_back( GL_TRUE );
attributes.push_back( 0L );
_pbuffer = glXCreateGLXPbufferSGIX(_display, fbconfig, _traits->width, _traits->height, &attributes.front() );
if (_pbuffer)
{
int iWidth = 0;
int iHeight = 0;
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::notify(osg::NOTICE) << "PixelBufferX11::init(), SGIX_pbuffer created with different size then requsted" << std::endl;
osg::notify(osg::NOTICE) << "\tRequested size (" << _traits->width << "," << _traits->height << ")" << std::endl;
osg::notify(osg::NOTICE) << "\tPbuffer size (" << iWidth << "," << iHeight << ")" << std::endl;
_traits->width = iWidth;
_traits->height = iHeight;
}
}
XFree( fbconfig );
}
#endif