[osg-users] osg::Cylinder height change not shown in OSG 3.6.3
Robert Osfield
robert.osfield at gmail.com
Tue Nov 27 00:32:00 PST 2018
Hi Stuart,
The new ShapeDrawable is written completely differently, and is now
subclassed from osg::Geometry and has ShapeDrawable::build() function that
computes all the appropriate vertex arrays etc, So try just calling
shapedrawabl->build() when you update the shape.
I should however suggest that perhaps ShapeDrawable isn't the tool for the
job for this type of interactive updating, it's written as a create once,
use many times features. If you are updating the height interactively then
it may be best to just use a shader to set the height within the vertex
shader. For instance if you had a 1000 cyclinders that all had
independently varying heights then I'd write this as an instanced geometry
with a uniform arrays or 1D texture that stores the position and sizes then
have the vertex shader positing and scale the geometry accordingly. This
way you'd just update the uniform/1D texture in a super lightweigth way and
everything would just render smoothly and efficiently.
Cheers,
Robert.
On Mon, 26 Nov 2018 at 21:55, Stuart Mentzer <osgforum at tevs.eu> wrote:
> Hi,
>
> I have an osg::Cylinder in an osg::ShapeDrawable and I change its height
> in an UpdateCallback like this:
>
> Code:
> cylinder->setHeight( h );
> drawable->dirtyDisplayList();
> drawable->dirtyBound();
>
>
>
>
> This works in OSG 3.4.1 but with OSG 3.6.3 (at least on my Windows builds)
> the height change doesn't show up. Checking the value with getHeight shows
> that the cylinder height is updated so maybe the issue is that
> dirtyDisplayList is no longer sufficient to trigger the display update.
>
> I can try to put together a small self-contained example if this doesn't
> give anyone a clue what is going on.
>
> Any help will be much appreciated. And if this has exposed an OSG bug it
> would be good to fix for 3.6.4.
>
> Thanks!
>
> Cheers,
> Stuart
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75246#75246
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20181127/395c8c76/attachment.html>
More information about the osg-users
mailing list