Geeks3D Forums

GeeXLab => GeeXLab - english forum => Topic started by: groundhog on February 29, 2016, 03:27:08 PM

Title: Fastest way to upload vertices?
Post by: groundhog on February 29, 2016, 03:27:08 PM
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!

Title: Re: Fastest way to upload vertices?
Post by: JeGX on March 01, 2016, 03:38:02 PM
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.
Title: Re: Fastest way to upload vertices?
Post by: groundhog on March 01, 2016, 04:52:33 PM
Quote
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.

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!
Title: Re: Fastest way to upload vertices?
Post by: JeGX on April 14, 2016, 06:27:32 PM
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!
Title: Re: Fastest way to upload vertices?
Post by: groundhog on April 18, 2016, 04:27:17 PM
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!