GLVisualize - Render dynamically created and destroyed particles

Hi everyone,

I am looking for a way to realize the following situation with GLVisualize:

Given a dynamics under which “particles” are created and destroyed.
Output is a vector of positions. I would like to visualize the particles as spheres in the plane.

The naive solution follows along the lines of

using GLVisualize, GLAbstraction, GeometryTypes, Reactive

window = glscreen();

timesignal = fps(1);

# Randomize up to 50 positions in the z=0 plane
positions = map(_->[Point3f0(rand(2)...,0) for _ in 1:rand(1:50)], timesignal)

robj = visualize((HyperSphere(Point3f0(0),0.1f0),positions))

@async renderloop(window)

where position is obviously a mockup of a real dynamics.

This approach however won’t work, because

Failed to push!
to node
    42: "1 fps" = 2.2109999656677246 Float64 (active)

error at node: 66: "map(input-36, map(1 fps))" = nothing Void (active)
Dynamic resizing not implemented for GLAbstraction.TextureBuffer{GeometryTypes.Point{3,Float32}}
update!(::GLAbstraction.TextureBuffer{GeometryTypes.Point{3,Float32}}, ::Array{GeometryTypes.Point{3,Float32},1}) at C:\Users\stephan\.julia\v0.6\GLAbstraction\src\AbstractGPUArray.jl:81
(::Reactive.##33#34{GLAbstraction.#update!,Reactive.Signal{Void},Tuple{Reactive.Signal{GLAbstraction.TextureBuffer{GeometryTypes.Point{3,Float32}}},Reactive.Signal{Array{GeometryTypes.Point{3,Float32},1}}}})() at C:\Users\stephan\.julia\v0.6\Reactive\src\operators.jl:39
foreach(::Reactive.#runaction, ::Array{Function,1}) at .\abstractarray.jl:1733
run_node(::Reactive.Signal{Void}) at C:\Users\stephan\.julia\v0.6\Reactive\src\core.jl:312
run_push(::Reactive.Signal{Float64}, ::Float64, ::Reactive.#print_error, ::Bool) at C:\Users\stephan\.julia\v0.6\Reactive\src\core.jl:330
run_push(::Reactive.Signal{Float64}, ::Float64, ::Function) at C:\Users\stephan\.julia\v0.6\Reactive\src\core.jl:317
run(::Int64) at C:\Users\stephan\.julia\v0.6\Reactive\src\core.jl:277
(::Reactive.##27#29)() at .\task.jl:335

One could probably create a new render object for each position, but that seems like it’d waste a lot of performance. Or maybe not? I am not well-versed in neither OpenGL nor GLVisualize.

Is there a preferred way to do what I’m trying to achieve here?

Thanks in advance for your help!

I posed the question on Github too.

The gist is, that it’s (currently) not working with mesh objects. One may either

  1. Use sprites instead of 3d objects, e.g Circle(Point2f0(0),0.1f0). Won’t look as nice, but works out.
  2. Initialize the render object with a large number max_particles and show only the ones that are “truly there”. For a simple implementation see the linked Github issue.
  3. Delete and visualize the render object anew each time the particle number changes