首先,设置可以使用Mipmap,启用三线性过滤,设置最大级别和最小级别
osg::ref_ptr<osg::TextureCubeMap> tcm = new osg::TextureCubeMap;
tcm->setTextureSize(128, 128);
tcm->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
tcm->setUseHardwareMipMapGeneration(true);
tcm->setMinLOD(0);
tcm->setMaxLOD(4 );
然后在shader中,用textureLod分别查看各个级别
“gl_FragColor = textureLod(tex0,dir,4);\n”//0,1,2,3,4
运行如下





代码如下:

文章详细描述了如何在OpenGl中创建并使用TextureCubeMap,设置了Mipmap、三线性过滤,以及在shader中通过textureLod查看不同级别。展示了如何加载图像文件并设置纹理属性。
最低0.47元/天 解锁文章
1419

被折叠的 条评论
为什么被折叠?



