Chinaunix首页 | 论坛 | 博客
  • 博客访问: 107789
  • 博文数量: 51
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 520
  • 用 户 组: 普通用户
  • 注册时间: 2015-07-07 10:17
文章分类

全部博文(51)

文章存档

2017年(2)

2016年(36)

2015年(13)

我的朋友

分类: 虚拟化

2015-12-04 15:15:21

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) |
给主人留下些什么吧!~~