Hi Robert,

The compile error under VS2010 says 'sqrt' ambiguous call to
overloaded function. Because sqrt() requires float, double, or long
double type of parameter. The following line should work:

unsigned int num_files_per_row =
std::max(osg::round(sqrt(static_cast<double>(std::min(max_videos,
static_cast<unsigned int>(files.size()))))), 1.0);

Wang Rui


2012/10/9 Robert Osfield <[email protected]>:
> Hi Rui,
>
> With your change I now get a compile error:
>
> /home/robert/OpenSceneGraph/examples/osgmultiplemovies/osgmultiplemovies.cpp:
> In member function ‘void SlideShowEventHandler::loadSlide(int)’:
> /home/robert/OpenSceneGraph/examples/osgmultiplemovies/osgmultiplemovies.cpp:531:46:
> warning: comparison between signed and unsigned integer expressions
> [-Wsign-compare]
> /home/robert/OpenSceneGraph/examples/osgmultiplemovies/osgmultiplemovies.cpp:
> In function ‘int main(int, char**)’:
> /home/robert/OpenSceneGraph/examples/osgmultiplemovies/osgmultiplemovies.cpp:654:116:
> error: no matching function for call to ‘minimum(unsigned int&,
> std::vector<std::basic_string<char> >::size_type)’
> /home/robert/OpenSceneGraph/examples/osgmultiplemovies/osgmultiplemovies.cpp:654:116:
> note: candidate is:
> /home/robert/OpenSceneGraph/include/osg/Math:161:10: note:
> template<class T> T osg::minimum(T, T)
>
>
> At a guess I'd assume that the compile error you are seeing is down to
> the max_videos and files.size() returning different types, so I've
> introduced a cast:
>
> Index: examples/osgmultiplemovies/osgmultiplemovies.cpp
> ===================================================================
> --- examples/osgmultiplemovies/osgmultiplemovies.cpp    (revision 13165)
> +++ examples/osgmultiplemovies/osgmultiplemovies.cpp    (working copy)
> @@ -651,7 +651,7 @@
>      {
>          movie_event_handler = new MovieEventHandler();
>
> -        unsigned int num_files_per_row =
> std::max(osg::round(sqrt(std::min<unsigned int>(max_videos,
> files.size()))), 1.0);
> +        unsigned int num_files_per_row =
> std::max(osg::round(sqrt(std::min(max_videos, static_cast<unsigned
> int>(files.size())))), 1.0);
>          static const float new_row_at = num_files_per_row *
> desired_height * 16 / 9.0;
>
> This is now checked into svn/trunk, could you let me know if this
> fixes the build or not.
>
> Thanks,
> Robert.
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to