Disable mipmaps for GUI textures

For some reason, the mipmap generator seems to be broken on Linux Intel graphics (works on Nvidia). This was breaking the scrollbar arrows, which are minified enough to show using a mipmap.
sceneinput
scrawl 10 years ago
parent dca4704b4b
commit c4866bdfc6

@ -87,6 +87,8 @@ namespace osgMyGUI
throw std::runtime_error("No texturemanager set");
mTexture = mTextureManager->getTexture2D(fname, osg::Texture2D::CLAMP_TO_EDGE, osg::Texture2D::CLAMP_TO_EDGE);
// disable mip-maps
mTexture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
// FIXME
mFormat = MyGUI::PixelFormat::R8G8B8;

@ -64,7 +64,30 @@ namespace Resource
for (std::map<MapKey, osg::ref_ptr<osg::Texture2D> >::iterator it = mTextures.begin(); it != mTextures.end(); ++it)
{
osg::ref_ptr<osg::Texture2D> tex = it->second;
tex->setFilter(osg::Texture::MIN_FILTER, mMinFilter);
// Keep mip-mapping disabled if the texture creator explicitely requested it.
osg::Texture::FilterMode oldMin = tex->getFilter(osg::Texture::MIN_FILTER);
if (oldMin == osg::Texture::LINEAR || oldMin == osg::Texture::NEAREST)
{
osg::Texture::FilterMode newMin = osg::Texture::LINEAR;
switch (mMinFilter)
{
case osg::Texture::LINEAR:
case osg::Texture::LINEAR_MIPMAP_LINEAR:
case osg::Texture::LINEAR_MIPMAP_NEAREST:
newMin = osg::Texture::LINEAR;
break;
case osg::Texture::NEAREST:
case osg::Texture::NEAREST_MIPMAP_LINEAR:
case osg::Texture::NEAREST_MIPMAP_NEAREST:
newMin = osg::Texture::NEAREST;
break;
}
tex->setFilter(osg::Texture::MIN_FILTER, newMin);
}
else
tex->setFilter(osg::Texture::MIN_FILTER, mMinFilter);
tex->setFilter(osg::Texture::MAG_FILTER, mMagFilter);
tex->setMaxAnisotropy(static_cast<float>(mMaxAnisotropy));
}

Loading…
Cancel
Save