private static VertexBufferPCT recreate(final VertexBufferPCT vb, final int newLength) { if (vb == null) { return VertexBufferPCT.Factory.newPooledInstance(newLength); } if (vb.getMaxVertices() < newLength) { vb.removeReference(); return VertexBufferPCT.Factory.newPooledInstance(newLength); } return vb; }
private void addGeometry(final TextData data) { final GeometryMesh geom = ((MemoryObject.ObjectFactory<GeometryMesh>) GLGeometryMesh.Factory).newPooledInstance(); final int numVertices = 16; final VertexBufferPCT vertexBuffer = VertexBufferPCT.Factory.newPooledInstance(16); final IndexBuffer indexBuffer = IndexBuffer.INDICES; vertexBuffer.setNumVertices(16); for (int i = 0, size = vertexBuffer.getNumVertices(); i < size; ++i) { vertexBuffer.setVertexColor(i, 1.0f, 1.0f, 1.0f, 1.0f); } geom.create(GeometryMesh.MeshType.Line, vertexBuffer, indexBuffer); this.m_entity3D.addGeometry(geom); geom.removeReference(); vertexBuffer.removeReference(); }