[osg-users] Dynamic Geometry per frame
Sebastian Messerschmidt
sebastian.messerschmidt at gmx.de
Thu Apr 9 01:49:10 PDT 2015
HI Adam
Simply configurethe geometry to
geom->setUseDisplayList(false);
geom->setUseVertexBufferObjects(true);
in order to deactivate the display list generation
Also, I think you don't have to use setVertexArray, as long as you keep
the array as a pointer. (@Robert, is the data actually copied?)
Cheers
Sebastian
> I'm looking for ideas/the correct way to implement a vertex array or VBO in OSG that gets updated each frame.
>
> I have a camera that renders to a FBO. It renders a bunch of rain drops to an alpha texture that is applied to a cars windshield. Each frame on the CPU I update the rain drops to move down, and I also spawn new ones and erase ones where the wipers wipe them away.
>
> I created a callback class inherting from osg::Drawable::UpdateCallback, that gets called each frame, I perform my logic and then re-use the same osg::Vec3Array and just update it per frame and then reset the drawable with:
>
> osg::Geometry* geometryNode = drawable->asGeometry();
> geometryNode ->setVertexArray(rainState->vertices);
>
> Unfortunately this setVertexArray is killing my framerate from 98 to 78. All this does is make the Drawable::draw() function make a new display list, do the draw functions and finish.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=63294#63294
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list