make GpuProgramParameters::setConstant easier to use

What it says on the tin: a place to discuss proposed new features.
Post Reply
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

make GpuProgramParameters::setConstant easier to use

Post by cyrfer »

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.
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Post by Praetor »

You mean setting a shader constant by name, like the setNamedConstant function? I think that'll do what you want.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Post by nullsquared »

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

Post by Praetor »

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.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Post by nullsquared »

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?
According to his previous thread, that's what he wants, AFAICU.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Post by cyrfer »

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?
That is precisely correct. Please, just read the link about glGetUniformLocation.

Thank you.
Post Reply