diff --git a/simgear/canvas/ODGauge.cxx b/simgear/canvas/ODGauge.cxx index f7e95c4d..12bb52d2 100644 --- a/simgear/canvas/ODGauge.cxx +++ b/simgear/canvas/ODGauge.cxx @@ -250,10 +250,16 @@ namespace canvas if( !texture ) { + // It shouldn't be necessary to allocate an image for the + // texture that is the target of dynamic rendering, but + // otherwise OSG won't construct all the mipmaps for the texture + // and dynamic mipmap generation doesn't work. + osg::Image* image = new osg::Image; + image->allocateImage(_size_x, _size_y, 1, GL_RGBA, GL_UNSIGNED_BYTE); texture = new osg::Texture2D; texture->setResizeNonPowerOfTwoHint(false); - texture->setTextureSize(_size_x, _size_y); - texture->setInternalFormat(GL_RGBA); + texture->setImage(image); + texture->setUnRefImageDataAfterApply(true); } updateSampling();