From Farshid Lashkari,

"I was experiencing hard crashes of my application when using PBO's on
machines that don't support PBO's. I think osg incorrectly checks if
PBO's are supported.

I added a new method to the BufferObject::Extensions class which
returns if the "GL_ARB_pixel_buffer_object" string is supported. This
fixes the problem on my end. Machines without PBO support will
continue to work and machines with PBO support will still be able to
use it."
This commit is contained in:
Robert Osfield 2006-08-25 08:48:16 +00:00
parent 8365ec3217
commit 0900857333
4 changed files with 9 additions and 5 deletions

View File

@ -106,6 +106,7 @@ class OSG_EXPORT BufferObject : public Object
};
inline bool isBufferObjectSupported(unsigned int contextID) const { return getExtensions(contextID,true)->isBufferObjectSupported(); }
inline bool isPBOSupported(unsigned int contextID) const { return getExtensions(contextID,true)->isPBOSupported(); }
inline GLuint& buffer(unsigned int contextID) const { return _bufferObjectList[contextID]; }
@ -153,6 +154,7 @@ class OSG_EXPORT BufferObject : public Object
void setupGLExtenions(unsigned int contextID);
bool isBufferObjectSupported() const { return _glGenBuffers!=0; }
bool isPBOSupported() const { return _isPBOSupported; }
void glGenBuffers (GLsizei n, GLuint *buffers) const;
void glBindBuffer (GLenum target, GLuint buffer) const;
@ -192,6 +194,7 @@ class OSG_EXPORT BufferObject : public Object
GetBufferParameterivProc _glGetBufferParameteriv;
GetBufferPointervProc _glGetBufferPointerv;
bool _isPBOSupported;
};
/** Function to call to get the extension of a specified context.

View File

@ -182,7 +182,7 @@ void BufferObject::Extensions::lowestCommonDenominator(const Extensions& rhs)
if (!rhs._glGetBufferParameteriv) _glGetBufferPointerv = rhs._glGetBufferPointerv;
}
void BufferObject::Extensions::setupGLExtenions(unsigned int)
void BufferObject::Extensions::setupGLExtenions(unsigned int contextID)
{
_glGenBuffers = ((GenBuffersProc)osg::getGLExtensionFuncPtr("glGenBuffers","glGenBuffersARB"));
_glBindBuffer = ((BindBufferProc)osg::getGLExtensionFuncPtr("glBindBuffer","glBindBufferARB"));
@ -195,6 +195,7 @@ void BufferObject::Extensions::setupGLExtenions(unsigned int)
_glUnmapBuffer = ((UnmapBufferProc)osg::getGLExtensionFuncPtr("glUnmapBuffer","glUnmapBufferARB"));
_glGetBufferParameteriv = ((GetBufferParameterivProc)osg::getGLExtensionFuncPtr("glGetBufferParameteriv","glGetBufferParameterivARB"));
_glGetBufferPointerv = ((GetBufferPointervProc)osg::getGLExtensionFuncPtr("glGetBufferPointerv","glGetBufferPointervARB"));
_isPBOSupported = osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object");
}
void BufferObject::Extensions::glGenBuffers(GLsizei n, GLuint *buffers) const

View File

@ -897,7 +897,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
unsigned char* dataPlusOffset = 0;
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isBufferObjectSupported(contextID) && !needImageRescale)
if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale)
{
pbo->compileBuffer(state);
pbo->bindBuffer(contextID);
@ -1149,7 +1149,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
unsigned char* dataPlusOffset=0;
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isBufferObjectSupported(contextID) && !needImageRescale)
if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale)
{
pbo->compileBuffer(state);
pbo->bindBuffer(contextID);

View File

@ -283,7 +283,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
unsigned char* dataPlusOffset = 0;
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isBufferObjectSupported(contextID))
if (pbo && pbo->isPBOSupported(contextID))
{
pbo->compileBuffer(state);
pbo->bindBuffer(contextID);
@ -350,7 +350,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
unsigned char* dataPlusOffset = 0;
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isBufferObjectSupported(contextID))
if (pbo && pbo->isPBOSupported(contextID))
{
pbo->compileBuffer(state);
pbo->bindBuffer(contextID);