From Colin McDonald, "An earlier fix in OSG 3.2 has been inadvertently lost in 3.3.x. The glGenerateMipMap function is part of the GL_EXT_framebuffer_object extension. Just checking if the function is present before using it for texture mipmaps is not sufficient, as on remote X-windows displays the client side capability may be different from the display server. This can lead to mipmapped textures failing to render. I've restored a fbo extension check. I've also tided up the GL version checking a little."

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14907 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-06-10 16:47:15 +00:00
parent d2e0081690
commit e76c91ed78
2 changed files with 20 additions and 18 deletions

View File

@@ -2699,7 +2699,8 @@ bool Texture::isHardwareMipmapGenerationEnabled(const State& state) const
return true;
}
if (extensions->glGenerateMipmap)
// FrameBufferObjects are required for glGenerateMipmap
if (extensions->isFrameBufferObjectSupported && extensions->glGenerateMipmap)
{
return true;
}
@@ -2717,7 +2718,7 @@ Texture::GenerateMipmapMode Texture::mipmapBeforeTexImage(const State& state, bo
#else
const GLExtensions* extensions = state.get<GLExtensions>();
bool useGenerateMipMap = extensions->glGenerateMipmap!=0;
bool useGenerateMipMap = extensions->isFrameBufferObjectSupported && extensions->glGenerateMipmap;
if (useGenerateMipMap)
{
@@ -2788,8 +2789,8 @@ void Texture::generateMipmap(State& state) const
// get fbo extension which provides us with the glGenerateMipmapEXT function
osg::GLExtensions* ext = state.get<GLExtensions>();
// check if the function is supported
if (ext->glGenerateMipmap)
// FrameBufferObjects are required for glGenerateMipmap
if (ext->isFrameBufferObjectSupported && ext->glGenerateMipmap)
{
textureObject->bind();
ext->glGenerateMipmap(textureObject->target());