texture = TextureBuilder::buildFromType(effect, type, prop,
options);
}
- catch (BuilderException& ) {
- SG_LOG(SG_INPUT, SG_ALERT, "No image file, "
+ catch (BuilderException& e) {
+ SG_LOG(SG_INPUT, SG_ALERT, e.getFormattedMessage() << ", "
<< "maybe the reader did not set the filename attribute, "
- << "using white on " << pass->getName());
+ << "using white for type '" << type << "' on '" << pass->getName() << "', in " << prop->getPath() );
texture = StateAttributeFactory::instance()->getWhiteTexture();
}
pass->setTextureAttributeAndModes(unit, texture);
const SGPropertyNode* pImage
= getEffectPropertyChild(effect, props, "image");
string imageName;
+ string absFileName;
if (pImage)
+ {
imageName = pImage->getStringValue();
- string absFileName = osgDB::findDataFile(imageName, options);
+ absFileName = SGModelLib::findDataFile(imageName, options);
+ if (absFileName.empty())
+ {
+ SG_LOG(SG_INPUT, SG_ALERT, "Texture file not found: '"
+ << imageName << "'");
+ }
+ }
const SGPropertyNode* pMipmapControl
= getEffectPropertyChild(effect, props, "mipmap-control");
= osgDB::Registry::instance()->readImage(imageName, options);
if (result.success()) {
osg::ref_ptr<osg::Image> image = result.getImage();
- image = computeMipmap( image, attrs.get<7>() );
- tex->setImage(GL_FRONT_AND_BACK, image);
+ image = computeMipmap( image.get(), attrs.get<7>() );
+ tex->setImage(GL_FRONT_AND_BACK, image.get());
int s = image->s();
int t = image->t();
if (s <= t && 32 <= s) {