osg 添加纹理

博客详细介绍了如何在OpenSceneGraph(osg)中添加并应用自定义形状的纹理,展示了丰富的图形渲染技术。
摘要由CSDN通过智能技术生成
#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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值