|
int main()
{
osg::ref_ptr<osg::Image>image_in = new osg::Image;
image_in = osgDB::readImageFile("Images/os64.png");
int s0, t0, r0;
int count = 0;
s0 = image_in->s();
t0 = image_in->t();
r0 = image_in->r();
for (unsigned i = 0; i < s0; i++)
{
for (unsigned j = 0; j < t0; j++)
{
osg::Vec4 color = image_in->getColor(i, j, 1);
count++;
std::cout << count << ":" << color.x() << " " << color.y() << " " << color.z() << std::endl;
}
}
osg::ref_ptr<osg:rawPixels>bitmap_in = new osg::DrawPixels;
bitmap_in->setPosition(osg::Vec3(0.0, 0.0, 0.0));
bitmap_in->setImage(image_in);
osg::ref_ptr<osg::Geode>geode = new osg::Geode;
geode->addDrawable(bitmap_in.get());
osg::ref_ptr<osgViewer::Viewer>viewer = new osgViewer::Viewer;
viewer->setSceneData(geode.get());
viewer->addEventHandler(new osgViewer::WindowSizeHandler);
return viewer->run();
}
每次执行到i=38或j=48就会中断,说+ image_in {_ptr=0x00bfb0e0 <无可用信息,未为 osgdb_pngd.dll 加载任何符号> }
换了好多图像,都会在循环到某个值时中断。
|
|