Merge /u/tbmoore/simgear/ branch tmoore/canvas-mipmap into next

https://sourceforge.net/p/flightgear/simgear/merge-requests/52/
This commit is contained in:
Stuart Buchanan 2020-02-12 21:02:43 +00:00
commit a4b79d6882

View File

@ -250,10 +250,16 @@ namespace canvas
if( !texture ) 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 = new osg::Texture2D;
texture->setResizeNonPowerOfTwoHint(false); texture->setResizeNonPowerOfTwoHint(false);
texture->setTextureSize(_size_x, _size_y); texture->setImage(image);
texture->setInternalFormat(GL_RGBA); texture->setUnRefImageDataAfterApply(true);
} }
updateSampling(); updateSampling();