|
发表于 2014-12-1 13:18:25
|
显示全部楼层
osg::StateSet * stateset = group->getOrCreateStateSet();
osg:rogram *program = new osg::Program;
osg::Shader* gaoguangVS = osg::Shader::readShaderFile(osg::Shader::VERTEX,"gaoguang.vert");
osg::Shader* gaoguangFS = osg::Shader::readShaderFile(osg::Shader::FRAGMENT, "gaoguang.frag");
program->addShader(new osg::Shader(osg::Shader::FRAGMENT,fragShader1));
program->addShader(gaoguangFS);
stateset->setAttributeAndModes(program,osg::StateAttribute::ON);
osg::Uniform* param1 = new osg::Uniform( "lightPos0", osg::Vec3(0.6f,0.9f,0.6f) );
stateset->addUniform( param1 );
|
|