Shaders parameters

Hi,

I’m using openscenegraph to apply vertex/fragment shaders to a whole scene.
I’m beginning to suspect an opengl misunderstanding so just a quick question to be sure :

with the same fragment program bound,
can I update its local parameters between
two primitives draw?

ie:
updateParams();
draw1();
updateParams();
draw2();

in draw1 i get the parameters from draw2, as if the driver changes the program parameters too fast then issues draw1…
any idea? =)

(hw note : quadro fx with nv 4363, since 4496 and 5328 don’t like me

thanx!
cbwan

That’s ARB_*_program, not GLslang.

But it is possible. If you are not changing these parameters between a glBegin and a glEnd it should work!

You need to “use” a specific program object before setting any of its uniform parameters.

Here’s an example:

// set program 1 parameters
glUseProgramObjectARB(program1);
glUniform1f(someParam, 1.0);

// set program 2 parameters 
glUseProgramObjectARB(program2);
glUniform1f(otherParam, 2.0);

// switch back to default fixed function rendering
glUseProgramObjectARB(0);

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.