#include <osgViewer/Viewer>
#include <osg/Group>
#include <osg/Geode>
#include <osg/Texture2D>
#include <osgDB/ReadFile>
#include <iostream>
osg::ref_ptr<osg::Node>CreateQuads()
{
osg::ref_ptr<osg::Geode>geod = new osg::Geode();
osg::ref_ptr<osg::Geometry>geom = new osg::Geometry();
osg::ref_ptr<osg::Vec3Array>pointArray = new osg::Vec3Array();
osg::ref_ptr<osg::Vec3Array>normal = new osg::Vec3Array();
osg::ref_ptr<osg::Texture2D>texture = new osg::Texture2D();
osg::ref_ptr<osg::Image>image = osgDB::readImageFile("Images/land_shallow_topo_2048.jpg");
pointArray->push_back(osg::Vec3(0.5,0.0,0.5));
pointArray->push_back(osg::Vec3(-0.5,0.0,0.5));
pointArray->push_back(osg::Vec3(-0.5,0.0,-0.5));
pointArray->push_back(osg::Vec3(0.5,0.0,-0.5));
normal->push_back(osg::Vec3(0.0,-1.0,0.0));
geom->setVertexArray(pointAr
osg 添加纹理
最新推荐文章于 2024-05-05 22:58:07 发布
博客详细介绍了如何在OpenSceneGraph(osg)中添加并应用自定义形状的纹理,展示了丰富的图形渲染技术。
摘要由CSDN通过智能技术生成