[osg-users] osgCal does not build - where is PerContextProgram::getUniformLocation( string ) method ?

11 views
Skip to first unread message

Wojciech Lewandowski

unread,
Dec 8, 2010, 6:35:24 AM12/8/10
to osg-...@lists.openscenegraph.org
Hi Guys,
 
The title says it all. We use osgCal and it does not compile anymore. Compiler  does not find Program::PerContextProgram::getUniformLocation( const std::string & ) while compiling HardwareMesh.cpp. Problem appeared with trunk change revision 11942:
 
Where 
    Program::PerContextProgram::getUniformLocation( const std::string & )
was replaced with:
    Program:: PerContextProgram::getUniformLocation( unsigned int )
 
I tried to look at modified PerContextProgram to figure out how to get uniform location knowing only uniform name but I was not able to come up with reasonable idea. Can anyone help me ?
 
Ideally we could possible retrofit PerProgramContext with a method that would accept  string name ? It does not mean reverting all the code that was changed recently I would only want to have another version of PerContextProgram::getUniformLocation( int ) with string parameter so that osgCall still compile.
 
Cheers,
Wojtek Lewandowski

Mourad Boufarguine

unread,
Dec 8, 2010, 6:47:02 AM12/8/10
to OpenSceneGraph Users
Hi Wojciech,

This change was introduced in rev 11952. This new static function in osg/Uniform should help you to get the (unsigned int) id out of the (string) name :


static unsigned int getNameID(const std::string& name);

Mourad


2010/12/8 Wojciech Lewandowski <lewan...@ai.com.pl>
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Wojciech Lewandowski

unread,
Dec 8, 2010, 7:32:06 AM12/8/10
to OpenSceneGraph Users
Thanks Mourad,
 
That solves my problem. I saw this method used inside the code but did not notice it is static so I thought it can be used only when we know the uniform ptr.
 
Do you think it makes sense to add following extra method to PerContextProgram ?
 
inline GLint  getUniformLocation( const std::string & name )
{
    return getUniformLocation( osg::Uniform::getNameId(  name ) );
}
 
Cheers,
Wojtek

Robert Osfield

unread,
Dec 8, 2010, 8:11:41 AM12/8/10
to OpenSceneGraph Users
Hi Wojtek,

On Wed, Dec 8, 2010 at 12:32 PM, Wojciech Lewandowski
<lewan...@ai.com.pl> wrote:
> That solves my problem. I saw this method used inside the code but did not
> notice it is static so I thought it can be used only when we know the
> uniform ptr.
>
> Do you think it makes sense to add following extra method to
> PerContextProgram ?
>
> inline GLint  getUniformLocation( const std::string & name )
> {
>     return getUniformLocation( osg::Uniform::getNameId(  name ) );
> }

For backwards compatibility purposes I have no objection to adding
this method and the above implementation into the OSG. Feel free to
implement, test and post the change to osg-submissions.

Robert.

Ulrich Hertlein

unread,
Dec 8, 2010, 4:42:07 PM12/8/10
to OpenSceneGraph Users
On 9/12/10 0:11 , Robert Osfield wrote:
>> Do you think it makes sense to add following extra method to
>> PerContextProgram ?
>>
>> inline GLint getUniformLocation( const std::string & name )
>> {
>> return getUniformLocation( osg::Uniform::getNameId( name ) );
>> }
>
> For backwards compatibility purposes I have no objection to adding
> this method and the above implementation into the OSG. Feel free to
> implement, test, *document it*, and post the change to osg-submissions.

FTFY. ;-)
/ulrich

Wojciech Lewandowski

unread,
Dec 8, 2010, 5:25:25 PM12/8/10
to OpenSceneGraph Users
YFTFM ? Where ? When ? WL

-----Oryginalna wiadomość-----
From: Ulrich Hertlein
Sent: Wednesday, December 08, 2010 10:42 PM


To: OpenSceneGraph Users
Subject: Re: [osg-users] osgCal does not build - where is
PerContextProgram::getUniformLocation( string ) method ?

On 9/12/10 0:11 , Robert Osfield wrote:

Ulrich Hertlein

unread,
Dec 8, 2010, 5:57:29 PM12/8/10
to OpenSceneGraph Users
Hi Wojciech,

On 9/12/10 9:25 , Wojciech Lewandowski wrote:
> YFTFM ? Where ? When ? WL

Not the code, just the response, sorry.
What I meant was, while you're there it would be nice to put a comment on the function
that describes the pitfalls of using it.

It's easier for the original author to do it (while it's still fresh etc) than for some
spelling/documenting bee to do it afterwards.

/ulrich

Reply all
Reply to author
Forward
0 new messages