Fastest way to upload vertices?

Started by groundhog, February 29, 2016, 03:27:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

groundhog

I am rendering a point cloud with several million points.
At the moment I upload them in a python loop using gxl_vertex_pool.vertex_set_position() and .vertex_set_color().

Is there a way to upload them in bulk from a (numpy) python array?
Should I use a separate gpu buffer and then use gh_vertex_pool.vertices_from_gpu_buffer()?
Or should I use vertex_poll map & unmap? But where is the buffer mapped?

Please help!


JeGX

I think the fastest way to upload your vertices is to have functions in the gh_vertex_pool that take a Python array as input. I will add such functions (for positions, colors) asap.

groundhog

QuoteI think the fastest way to upload your vertices is to have functions in the gh_vertex_pool that take a Python array as input.

That's what I had hoped for!

Would it be possible to specify the data type for the upload? E.g. using a numpy dtype or similar? I am uploading huge amounts of vertex data, but need only limited precision. int16 for xyz would suffice.

Thanks!

JeGX

A code sample that shows how to initialize a vertex pool with a Python array is available in the new code sample pack:

gl-21/vertex-pool-python/

I tested with 1'000'000 particles and initialization from Python arrays is really fast!

groundhog

Great, thanks!

I already integrated it in my code and the only thing I had to change was adding another element per vertex to get the correct stride (4) and flatten the array.
Works really fine!

Again: Thank you!