[osg-users] Multipassshading in OSG v1.2

Swen Walkowski usedformailinglists at googlemail.com
Thu Oct 11 06:50:21 PDT 2007


Hello all,

i try to do Multipassshading in OSG v1.2.
I have written my own shader class in the class I use the osg::shader
for shading. At the time my shading code looks like that:
Shader::Shader(void) {
 //creating program
 program = new osg::Program;

 //creating shader
 vertShader = new osg::Shader(osg::Shader::VERTEX);
 fragShader = new osg::Shader(osg::Shader::FRAGMENT);
}

Shader::~Shader(void) {
}

void Shader::apply(osg::StateSet& state) {
 state.setAttributeAndModes(program, osg::StateAttribute::ON);

 vertShader->loadShaderSourceFromFile("shaders/Fixed_Functionality.vert");
 fragShader->loadShaderSourceFromFile("shaders/Fixed_Functionality.frag");

 program->addShader(vertShader);
 program->addShader(fragShader);

 //parameterize the shader with video texture (0 by default)
 state.addUniform(new osg::Uniform("texture", 0));

 posXUniform = new osg::Uniform("posX", (float)0.0);
 posYUniform = new osg::Uniform("posY", (float)0.0);
 intensityUniform = new osg::Uniform("intensity", (float)1.0);
 radiusUniform = new osg::Uniform("radius", (float)0.2);

 state.addUniform(posXUniform);
 state.addUniform(posYUniform);
 state.addUniform(intensityUniform);
 state.addUniform(radiusUniform)
}

That works well.

Now i try to add an secend shading pass. I have read a lot over
rendering to texture (RTT) in OSG in the mailinglist. So I tryed to
find the examples or something in the OSG documentation.But without
luke.

Hope someone can tell me were I find the documentation for
Multipassshading in OSG or an example or maybe how it works.

Thangs,
Swen



More information about the osg-users mailing list