|
我自己构造了一个模型结点,然后利用GLSL语言渲染,我想把这个渲染得到的场景保存为一个纹理,不知该如何来做?
具体是这样的:
osg::ref_ptr<osg::Node> terrainnode = new osg::Node; //结点
terrainnode = createnode(latlonvalue1);
osg::Shader* vertexShader = new osg::Shader( osg::Shader::VERTEX );
osg::Shader* fragmentShader = new osg::Shader( osg::Shader::FRAGMENT );
vertexShader->loadShaderSourceFromFile( "xxx.vert" );
fragmentShader->loadShaderSourceFromFile( "xxx.frag" );
osg:rogram* program = new osg::Program;
program->addShader( vertexShader );
program->addShader( fragmentShader );
stateset->setAttributeAndModes( program, osg::StateAttribute::ON );
然后我不知道该如何把这个场景保存为一个texture2D里?谢谢! |
|