Best practices with jit.gl.multiple and varying number of instances
Hello,
I'm wondering if there are best practices when it comes to drawing a varying number of objects with gl.multiple. Say, I want to draw between 1 and 500 objects: what are the pros/cons of inputing matrices with a varying dim (1-500), or always draw 500 objects, making the "unused ones" transparent, or using something like attr.enable 0 for the unused ones?
Thanks for any advice!
Hi Jean Francois, using GL3 the shapes will be drawn using GPU instancing, which is very performing.
Making the unused ones transparent should not bring any computation benefit. Also you cannot set the attr.enable 0 in GL3 (not sure about GL2).
I would say, just go for it. If you hit any bottleneck you can post the patch here and we will try to help you.
Thanks. I see, gl3 brings a new level of efficiency in that regard. I've been delaying the switch to gl3, but I know I have to work on it! (I have to update some of my code to make it work...)
It's worth it!