xarray / osgRecipes

OpenSceneGraph (OSG) Recipes
348 stars 167 forks source link

Error with computeBounds functions in the Cookbook's examples and OSG's current master branch. #13

Closed AdriCS closed 10 years ago

AdriCS commented 10 years ago

In NurbsSurface and CloudBlock , the function computeBound is redefined. But with the current OSG's master brach, the build process ends in an error:

error: invalid covariant return type for 'virtual osg::BoundingBox NurbsSurface::computeBound() const'
error: overriding 'virtual osg::BoundingSphere osg::Drawable::computeBound() cost'

It seems that now Drawable has two functions for computing the bounds. The old computeBound now returns a BoundingSphere, whereas the one returning a BoundingBox is now named computeBoundingBox. Even though master isn't a stable release, I think the changes will remain for future releases.

Modifying the source code for NurbsSurface and changing computeBound to computeBoundingBox let me continue with the build.

I can make a pull request with the changes if you want. :)

xarray commented 10 years ago

Thanks Ardi. This is because the latest OSG trunk redefines Drawable as a Node type so computeBound() returns a sphere bound by default, as well as a new computeBoundBox() method for precise use. We need to update the recipes to fit this, but had better keep some backward compatibility for older versions, maybe using the OSG_VERSION_GREATER macro.

It would be much appreciated if you could make a pull request, as I'm busy with some client work now. :-)

AdriCS commented 10 years ago

Hi!

I'll send you the pull request next week! :D

Cheers!

PS: It's Adri, not Ardi ;)

On 24 October 2014 03:39, Rui Wang notifications@github.com wrote:

Thanks Ardi. This is because the latest OSG trunk redefines Drawable as a Node type so computeBound() returns a sphere bound by default, as well as a new computeBoundBox() method for precise use. We need to update the recipes to fit this, but had better keep some backward compatibility for older versions, maybe using the OSG_VERSION_GREATER macro.

It would be much appreciated if you could make a pull request, as I'm busy with some client work now. :-)

— Reply to this email directly or view it on GitHub https://github.com/xarray/osgRecipes/issues/13#issuecomment-60334167.

1ADZX commented 4 years ago

Hi!

I'll send you the pull request next week! :D

Cheers!

PS: It's Adri, not Ardi ;)

On 24 October 2014 03:39, Rui Wang notifications@github.com wrote:

Thanks Ardi. This is because the latest OSG trunk redefines Drawable as a Node type so computeBound() returns a sphere bound by default, as well as a new computeBoundBox() method for precise use. We need to update the recipes to fit this, but had better keep some backward compatibility for older versions, maybe using the OSG_VERSION_GREATER macro. It would be much appreciated if you could make a pull request, as I'm busy with some client work now. :-) — Reply to this email directly or view it on GitHub #13 (comment).

Hello, I have the same problem as you. Can you tell me how to solve it? I don't know where to use OSG VERSION Greeter macro, thank you

1ADZX commented 4 years ago

This is my compile error message

In file included from /home/dzx/sonar_simulation/gui/osg_ocean/include/osgOcean/FFTOceanSurfaceVBO:21:0, from /home/dzx/sonar_simulation/gui/osg_ocean/src/osgOcean/FFTOceanSurfaceVBO.cpp:18: /home/dzx/sonar_simulation/gui/osg_ocean/include/osgOcean/MipmapGeometryVBO:147:26: error: invalid covariant return type for ‘virtual osg::BoundingBox osgOcean::MipmapGeometryVBO::computeBound() const’ osg::BoundingBox computeBound( void ) const; ^ In file included from /usr/local/include/osg/Geode:18:0, from /home/dzx/sonar_simulation/gui/osg_ocean/include/osgOcean/OceanTechnique:20, from /home/dzx/sonar_simulation/gui/osg_ocean/include/osgOcean/FFTOceanTechnique:20, from /home/dzx/sonar_simulation/gui/osg_ocean/include/osgOcean/FFTOceanSurfaceVBO:20, from /home/dzx/sonar_simulation/gui/osg_ocean/src/osgOcean/FFTOceanSurfaceVBO.cpp:18: /usr/local/include/osg/Drawable:155:32: error: overriding ‘virtual osg::BoundingSphere osg::Drawable::computeBound() const’ virtual BoundingSphere computeBound() const; ^ src/osgOcean/CMakeFiles/osgOcean.dir/build.make:158: recipe for target 'src/osgOcean/CMakeFiles/osgOcean.dir/FFTOceanSurfaceVBO.cpp.o' failed