From 10f1d84f7e8c99441338ba8cc2637dbb4f53f498 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 1 Sep 2016 14:42:58 +0100 Subject: [PATCH] Added explict setup of the stats graphing geometry so that it's VertexBufferObject is intialized to the correct size to prevent any need for later resizing --- src/osgViewer/StatsHandler.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index 39b77f9c3..e2c373573 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -753,7 +753,15 @@ protected: setUseDisplayList(false); setDataVariance(osg::Object::DYNAMIC); - setVertexArray(new osg::Vec3Array); + osg::ref_ptr vbo = new osg::VertexBufferObject; + vbo->setUsage(GL_DYNAMIC_DRAW); + vbo->getProfile()._size = (width)*12; + + osg::ref_ptr vertices = new osg::Vec3Array; + vertices->setBufferObject(vbo.get()); + vertices->reserve(width); + + setVertexArray(vertices.get()); osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(color);