Added using of VertexBufferObject and ElementsBufferObject classes

This commit is contained in:
Robert Osfield 2007-04-26 16:50:35 +00:00
parent a3e6d8283d
commit 2929667dc4

View File

@ -220,6 +220,11 @@ osg::Node* createModel(const std::string& shader, const std::string& textureFile
geom->setVertexArray(vertices);
osg::VertexBufferObject* vbObject = new osg::VertexBufferObject;
vertices->setVertexBufferObject(vbObject);
osg::ElementsBufferObject* ebo = new osg::ElementsBufferObject;
for(iy=0; iy<num_y-1; ++iy)
{
unsigned int element_no = 0;
@ -230,7 +235,9 @@ osg::Node* createModel(const std::string& shader, const std::string& textureFile
(*elements)[element_no++] = index + num_x;
(*elements)[element_no++] = index++;
}
geom->addPrimitiveSet(elements);
geom->addPrimitiveSet(elements);
if (ebo) elements->setElementsBufferObject(ebo);
}
geom->setUseVertexBufferObjects(vbo);