sphereShape = new osg::Sphere(center, radius);
//texture
osg::ref_ptr
image = osgDB::readImageFile(filePath);
if (!image.get())
{
std::cout<<"open file is failed!"<
return NULL;
}
osg::ref_ptr texture = new osg::Texture2D;
texture->setDataVariance(osg::Object::DYNAMIC);
texture->setImage(image.get());
texture->setUnRefImageDataAfterApply(true);//release image memory
//modify 12-3
P_TO_EDGE);
texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
//解决纹理缝隙
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
_EDGE);
//设置纹理环绕模式
纹理坐标范围0~1,超出纹理坐标范围对纹理的相应设置
:Repeat(重复),Clamp(截取)
Repeat:超出的部分对纹理进行复制
CLAMP是截取超过1的范围像素取值为1上的像素值,小于0的像素取值为0上的像素值,截取模式还可以分为两个模式CLAMP_TO_EDGE和CLAMP_TO_BORDER
阅读(3791) | 评论(0) | 转发(0) |