[osg-users] Constructor parameters of osg::Uniform

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Thu Jun 28 05:06:41 PDT 2018



Hi Werner,


> Hi all,
> 
> I recently discovered a strange case in creation of a Uniform:
> 
> farRadiusRescaleUniform=newosg::Uniform("farRadiusRescale",2.0f);
> 
> The only constructor I could find is like that:
> 
> Uniform(Typetype,conststd::string&name,intnumElements=1);
> 
> The wrong construction sometimes leads to unexpected results.
> Why is the compiler not reclaming about this mismatch in parameters?

This is called implicit conversion and is totally legal.
In order to make to compiler avoid implicit conversion it can be tagged 
as explicit. As i've tumbled over this one more than once it might 
acutally be a good idea to change the uniform constructors which take 
only the name and "numElements".

@Robert:
Any insights?

Cheers
Sebastian

> 
> - Werner -
> 
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 


More information about the osg-users mailing list