Parameter Shadowing (Cg)

Started by
1 comment, last by python_regious 19 years, 5 months ago
Hey All. I'm a little confuzled about the specifics of parameter shadowing in Cg + OpenGL. I've read the Cg documentation, and that essentially says that Cg keeps an internal variable, with the value that you assign. So, you assign the parameter, and it sticks. Now, surely, you can re-assign that parameter? So, for instance, say I wanted to set a parameter ( a uniform colour for instance ), draw something, then set that parameter to something else ( a different colour ), and draw something else... Would this work? I looked at the sample CgGL runtime code in the docs, and it has this:
// Set parameters that don't change:
// They can be set only once because of parameter shadowing.
cgGLSetTextureParameter(baseTexture, texture);
cgGLSetParameter4fv(someColor, constantColor);
Does that mean that the parameters baseTexture and someColor cannot change beyond this point, even if another call to cgGLSetParameter4fv is called, for instance? This basically has rather large rammifications on my handling of parameters/uniform variables in my engine, and depending on whether I can re-assign variables decides on which path I take. Thanks all.
If at first you don't succeed, redefine success.
Advertisement
I've both bound diffrent textures and float4's without any problems. I don't know if that is situational (maybe depending on what card is running) or just out dated but I've had no problems.
Superb. Cheers.
If at first you don't succeed, redefine success.

This topic is closed to new replies.

Advertisement