On Tue, Apr 28, 2009 at 10:19 AM, ami guru <dosto.wa...@gmail.com> wrote:
> Hello Robert,
> I have already implemented the scenario that i am looking for in OpenGL by
> setting the glUseProgram(0) to glUseProgram(whichShader).
> And i wanted to implement the same scenario in OSG. None of the example that
> accompany the repository have implemented
> the scenario that i m looking for except a discussion in the mailing list.

The OSG automatically does th glUseProgram(0) when you attach a blank
osg::Program to a subgraph's StateSet.

The OSG automatically does the  glUseProgram(programID)  when you
attach a osg::Program with shaders.

You can share shaders between multiple osg::Program, this means that
you'll only pay for compilation once for each shared shader, and then
once for linking for each osg::Program.   It's a efficient as you can
do it trying to manually do things yourself, so just use the standard
OSG osg::Program/osg::Shader functionality.  Don't try to be clever or
over complicate things.

osg-users mailing list

Reply via email to