Code: Select all
for(u32 x = 0; x < nb_vertices; x++)
{
buffer->getVertexBuffer().push_back(video::S3DVertex(l_VertexData[x].m_Position[0],
l_VertexData [x].m_Position[1],
l_VertexData[x].m_Position[2],
(float)l_VertexData[x].m_Normal[0],
(float)l_VertexData[x].m_Normal[1],
(float)l_VertexData[x].m_Normal[2],
video::SColor(255,0,255,255), 0, 1));
}
buffer->getIndexBuffer().set_used(0);
for(u32 y = 0; y < nb_vertices; y+=3)
{
buffer->getIndexBuffer().push_back(l_TriangleData[y].m_VertexIndices[0]);
buffer->getIndexBuffer().push_back(l_TriangleData[y].m_VertexIndices[1]);
buffer->getIndexBuffer().push_back(l_TriangleData[y].m_VertexIndices[2]);
}
buffer->getIndexBuffer().set_used(3*nb_vertices/2);
buffer->setDirty();
driver->drawMeshBuffer(buffer);
Code: Select all
driver->endScene();
buffer->getVertexBuffer().set_used(0);
buffer->getIndexBuffer().set_used(0);
I'm just curious to why? Is there a better way of creating and deleting vertexes every frame?
Many thanks.