Adding A Vertex To A Libgdx Mesh
the title basically. You can reserve more than you need when creating a mesh mesh = new Mesh(false, 100, 0, new VertexAttribute(Usage.Position, 3, 'a_position')); But there is no
Solution 1:
Adding is a bad idea because the underlying buffers must be recreated and that takes up a lot of time. Instead, one should allocate meshes in bulk and only render what is currently used.
For example mesh.render(GL10.GL_TRIANGLES,0,num_triangles);
As for updating the buffer:
FloatBuffer fbuftmp = mesh.getVerticesBuffer();
BufferUtils.copy(buf,fbuftmp,fbuftmp.capacity(),0);
Where buf
is an float array.
Use BufferUtils.copy for reason explained here
Post a Comment for "Adding A Vertex To A Libgdx Mesh"