PDA

View Full Version : shaders parameters



cbwan
12-31-2003, 02:04 AM
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 http://www.opengl.org/discussion_boards/ubb/wink.gif

thanx!
cbwan

Corrail
12-31-2003, 02:46 AM
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!

jra101
12-31-2003, 11:01 AM
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);