[osg-users] Dynamic Geometry per frame
Adam Pawlowski
adam_725_6yt at yahoo.com
Tue Apr 7 11:17:31 PDT 2015
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
More information about the osg-users
mailing list