[osg-users] multiple pixel shaders for one program ?

Robert Osfield robert.osfield at gmail.com
Mon Nov 30 05:20:16 PST 2009


HI Sebastien,

You can have multiple vertex, geometry and fragment osg::Shaders
attached to a single osg::Program.  All you need to do is make sure
that just one of the osg::Shaders contains the main for each of the
vertex, geometry and fragment components of the program - from you
example it looks like you probably already have this planned so would
expect you code as is to work.

Robert.

On Mon, Nov 30, 2009 at 12:48 PM, Sebastien Nerig <overseb77 at hotmail.com> wrote:
> Hi,
>
> I would like to know if it is possible to do that :
>
>
> Code:
>
> osg::Program* program = new osg::Program;
> osg::Shader* shader = new osg::Shader(osg::Shader::FRAGMENT);
> shader->loadShaderSourceFromFile("main.frag");
> program->addShader(shader);
>
> osg::Shader* shader1 = new osg::Shader(osg::Shader::FRAGMENT);
> shader1->loadShaderSourceFromFile("common.frag");
> program->addShader(shader1);
>
>
>
>
> Is it possible to add multiple pixel shaders for one program ?
> So I can put all my "common" function into a shader into multiple shader program.
>
> Thank you!
>
> Cheers,
> Sebastien
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=20576#20576
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


More information about the osg-users mailing list