[osg-users] changing dimensions of a box

Mat Monk matthias-minki at web.de
Fri Jun 2 16:25:23 PDT 2017


Dear Robert, 
thank you so much for your help.
My program is now able to change the boxes dimensions.
But how can i interrupt the dynamiccallback to change my vertex "factor" for example after 3 sec, so the box grows in y- direction instead of x-direction?

robertosfield wrote:
> HI Mat,
> 
> On 1 June 2017 at 16:42, Mat Monk <> wrote:
> 
> > As you said, I created a static box. But i dont understand the shaders function in the example osgshaders.
> > 
> 
> I guess you must be learning OpenGL/OpenGL Shaders as well as OSG then.
> 
> 
> > I found a example of a rotating quad and modified it, so it includes my box instead the quad. But finally i couldn't change the rotation to changing the dimensions in x-direction for examples.
> > 
> 
> Using callbacks to update the vertices is one possible solution, but
> the most heavy-wieght in terms of CPU cost.
> 
> If you want to modify the vertices of the geoemtry using a callback
> then you've done most of the required steps.  The only thing missing
> is that you have to iterate over all the vertices in the Vec3Array.
> Vec3Array is  std::vector<osg::Vec3> under the hood so knowledge of
> Standard C++ should help here.  Also look at the include/osg/Vec3f
> class to see what maths methods are available.
> 
> Robert.
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


Cheers,
Mat

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71012#71012




Attachments: 
http://forum.openscenegraph.org//files/main_655.cpp





More information about the osg-users mailing list