Merge pull request #355 from denyskoch/patch-1

Fix loading of 16bit PNG images
This commit is contained in:
OpenSceneGraph git repository 2017-10-05 16:29:37 +01:00 committed by GitHub
commit bc9f481c2b

View File

@ -307,6 +307,18 @@ class ReaderWriterPNG : public osgDB::ReaderWriter
pixelFormat = GL_RGBA;
int internalFormat = pixelFormat;
if (depth > 8)
{
switch(color)
{
case(GL_LUMINANCE): internalFormat = GL_LUMINANCE16; break;
case(GL_ALPHA): internalFormat = GL_ALPHA16; break;
case(GL_LUMINANCE_ALPHA): internalFormat = GL_LUMINANCE16_ALPHA16; break;
case(GL_RGB): internalFormat = GL_RGB16; break;
case(GL_RGBA): internalFormat = GL_RGBA16; break;
default: break;
}
}
png_destroy_read_struct(&png, &info, &endinfo);