Hi Robert, Well, I would even try to search for it, but right now I'm so busy I'll have to just skip it and use a hack. But if anyone out there has a bit more time, here's a piece of code and data to test it.
I don't remember if osg comes with the pkg-config script, but if not maybe I added mine by hand. In that case just replace that part by the include and lib paths. Compile with: c++ catpx.cpp -o catpx `PKG_CONFIG_PATH=/path/to/pkgconfig/dir pkg-config --cflags --libs openscenegraph openthreads` Runing with: OSG_NOTIFY_LEVEL=debug ./catpx pixel.png GraphicsContext::setWindowingSystemInterface() 0x10262cc30 0x10055db08 itr='/Users/paulo/usr/lib' FindFileInPath() : trying /Users/paulo/usr/lib/osgPlugins-3.0.0/osgdb_imageio.so ... FindFileInPath() : USING /Users/paulo/usr/lib/osgPlugins-3.0.0/osgdb_imageio.so Opened DynamicLibrary osgPlugins-3.0.0/osgdb_imageio.so FindFileInPath(pixel.png): returning pixel.png imageio readImageFile: pixel.png 0 0 0 0 GraphicsContext::setWindowingSystemInterface() 0 0x10055db08 So the plugin used is imageio and the result should be: 64 128 192 0 Somewhere in the loading some sort of alpha pre-multiplying is going on. :/
#include <osgDB/ReadFile>
#include <osg/ref_ptr>
#include <iostream>
#include <cassert>
typedef unsigned char byte;
struct Pixel {
byte c0;
byte c1;
byte c2;
byte alpha;
};
typedef osg::ref_ptr<osg::Image> ImagePtr;
int main(int n, char** c) {
if(n == 1) {
std::cout << "Usage: " << c[0] << " image.png" << std::endl;
return 0;
}
const ImagePtr img(osgDB::readImageFile(c[1]));
if(img == 0) {
std::cout << "Failed to load: " << c[1] << std::endl;
return 1;
}
const GLenum pxf(img->getPixelFormat());
if(not (pxf == GL_RGBA or pxf == GL_BGRA)) {
std::cout << "Image must be RGBA or BGRA, found: "
<< pxf << std::endl;
return 1;
}
const Pixel* const px(reinterpret_cast<const Pixel*>(img->data()));
std::cout << unsigned(px->c0) << ' '
<< unsigned(px->c1) << ' '
<< unsigned(px->c2) << ' '
<< unsigned(px->alpha) << std::endl;
return 0;
}
<<attachment: pixel.png>>
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

