A long time ago (May 2012) I reported an issue with the rendering of
Capsules (email below). I got sidetracked and did not follow it up to
realize a fix. However a fix for this can be found below. Add this to line
~828 after the numRows have been calculated and before drawHalfSphere is
called.

// Make sure that numRows is even so that the halfSpheres have
// equal size and align with the capsule body
numRows += 1;
numRows &= ~((unsigned int)1);


Cheers,

Anders


On 24 May 2012 09:06, Anders Backman <andersb at cs.umu.se
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>>
wrote:
>* Hi all.*>**>* Found a bug in ShapeDrawable.cpp*>* This is verified in 3.0.1 
>and 2.9.11:*>**>* Bug in OpenSceneGraph/src/osg/ShapeDrawable.cpp,  void*>* 
>DrawShapeVisitor::apply(const Capsule& capsule) :*>**>* If numRows becomes 
>odd, the capsule top and bottom parts created with two*>* calls to 
>drawHalfSphere will not*>* align with the cylinder body created with 
>drawCylinderBody.*>**>* Easiest seen if with large radius and few rows.*>* 
>Example capsule parameters:*>* height 8.4*>* radius 5*>**>* Set detail ratio 
>hints to 0.35 so numRows becomes 7. Misalign.*>* Change hints to 0.4, numRows 
>becomes 8 and capsule part aligns.*>**>* Fix:*>* If numRows is odd, add one 
>before calling drawHalfSphere.*>* I don't think the user should be aware of 
>this and have to pick a suitable*>* detailRatio.*

-- 
__________________________________________
Anders Backman, HPC2N
90187 UmeƄ University, Sweden
[email protected] http://www.hpc2n.umu.se
Cell: +46-70-392 64 67
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to