From Colin McDonald, "Add test for GL_EXT_framebuffer_object extension : osg uses osg::FBOExtensions to check if Frame Buffer Objects are

available.  But this just checks if the fbo functions can be called.
It doesn't check if the OpenGL renderer supports fbos.  For indirect
rendering on linux the client side capability may be different from
the display server, which can lead to mipmapped textures failing to
render.  I've added a fbo extension check.
"
This commit is contained in:
Robert Osfield
2013-09-09 13:33:13 +00:00
parent b20a74b017
commit e9697859bd
2 changed files with 6 additions and 4 deletions

View File

@@ -2351,7 +2351,7 @@ bool Texture::isHardwareMipmapGenerationEnabled(const State& state) const
const FBOExtensions* fbo_ext = FBOExtensions::instance(contextID,true);
if (fbo_ext->glGenerateMipmap)
if (fbo_ext->isSupported() && fbo_ext->glGenerateMipmap)
{
return true;
}
@@ -2368,7 +2368,8 @@ Texture::GenerateMipmapMode Texture::mipmapBeforeTexImage(const State& state, bo
return GENERATE_MIPMAP;
#else
bool useGenerateMipMap = FBOExtensions::instance(state.getContextID(), true)->glGenerateMipmap!=0;
FBOExtensions* fbo_ext = FBOExtensions::instance(state.getContextID(),true);
bool useGenerateMipMap = fbo_ext->isSupported() && fbo_ext->glGenerateMipmap;
if (useGenerateMipMap)
{
@@ -2440,7 +2441,7 @@ void Texture::generateMipmap(State& state) const
osg::FBOExtensions* fbo_ext = osg::FBOExtensions::instance(state.getContextID(), true);
// check if the function is supported
if (fbo_ext->glGenerateMipmap)
if (fbo_ext->isSupported() && fbo_ext->glGenerateMipmap)
{
textureObject->bind();
fbo_ext->glGenerateMipmap(textureObject->target());