Hi all

While writing an image conversion routine (OSG -> wxWidgets) I have
noticed something that I'd qualify as an inconsistency: the meaning of
the _internalTextureFormat member of osg::Image is different from
plugin to plugin.
For 24 and 32 bpp images, it is sometimes 3 or 4 (i.e. 3 or 4 bytes
per pixel) and sometimes GL_RGB or GL_RGBA. It is defined as a GLint
so the first version seems more correct - it should have been a GLenum
otherwise. You can see the strange thing when running this piece of
code in osgviewer:

       osg::Image* image = osgDB::readImageFile("Images/reflect.rgb");
       std::cout << "When loaded as RGB, internal texture format is " <<
image->getInternalTextureFormat() << std::endl;
       std::cout << "  data type is " << image->getDataType() << " and pixel
format is " << image->getPixelFormat() << std::endl;
       osgDB::writeImageFile(*image, "reflect.png");
       osg::Image* image2 = osgDB::readImageFile("reflect.png");
       std::cout << "When loaded as PNG, internal texture format is " <<
image2->getInternalTextureFormat() << std::endl;
       std::cout << "  data type is " << image2->getDataType() << " and
pixel format is " << image2->getPixelFormat() << std::endl;

the output is

When loaded as RGB, internal texture format is 3
 data type is 5121 and pixel format is 6407
When loaded as PNG, internal texture format is 6407
 data type is 5121 and pixel format is 6407

(6407 stands for GL_RGB)

There is something definitely strange with that, but I don't know well
enough the meaning of the "internal texture format" member to tell
whether the RGB plugin is buggy or the PNG one is. Maybe I'm simply
making the wrong assumptions about what this member is about.

Any hints ?

Thibault
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to