Hi,
The goal:
Have a function that provides the uniform index when the uniform name is known, much like glGetUniformLocation, so that GpuProgramParameters::setConstant can be used.
I'm not even sure yet that it is possible to use GpuProgramParameters::setConstant, unless you are comfortable when blindly guessing the value to pass for the "index" parameter. I think Ogre should have an easy to use function, maybe called 'GpuProgramParameters::getUniformLocationFromName' so that you will be able to figure out which value should be passed to GpuProgramParameters::setConstant. I've been trying to implement something like this for the past day, but if someone knows already, the solution would be much appreciated.
Thanks.
make GpuProgramParameters::setConstant easier to use
-
cyrfer
- Orc
- Posts: 424
- Joined: Wed Aug 01, 2007 8:13 pm
- Location: Venice, CA, USA
- x 7
- Praetor
- OGRE Retired Team Member

- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
- Contact:
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Check out this thread here: http://www.ogre3d.org/phpBB2/viewtopic.php?p=295259Praetor wrote:You mean setting a shader constant by name, like the setNamedConstant function? I think that'll do what you want.
- Praetor
- OGRE Retired Team Member

- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
- Contact:
Ok, I'm trying to understand the request, and I haven't yet "gotten" it. The other thread only helped a little. Let me try to work it out.
You have a high level shader, which uses named constants. Named constants are mapped to indices, which normally you look up and then use that looked up index to set it. You want to store and use directly that index each time you set the constant, instead of using the name?
I may have completely misread your intent, in fact it's likely.
You have a high level shader, which uses named constants. Named constants are mapped to indices, which normally you look up and then use that looked up index to set it. You want to store and use directly that index each time you set the constant, instead of using the name?
I may have completely misread your intent, in fact it's likely.
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
According to his previous thread, that's what he wants, AFAICU.Praetor wrote:You have a high level shader, which uses named constants. Named constants are mapped to indices, which normally you look up and then use that looked up index to set it. You want to store and use directly that index each time you set the constant, instead of using the name?
-
cyrfer
- Orc
- Posts: 424
- Joined: Wed Aug 01, 2007 8:13 pm
- Location: Venice, CA, USA
- x 7
That is precisely correct. Please, just read the link about glGetUniformLocation.Praetor wrote:You have a high level shader, which uses named constants. Named constants are mapped to indices, which normally you look up and then use that looked up index to set it. You want to store and use directly that index each time you set the constant, instead of using the name?
Thank you.