Is it possible to instantiate one object several times?
My use case is that if we have a scene with several identical elements
it will be nice to be able to create one single element (object, i.e.
cube, sphere) and instantiate (show) it as many times as wished in
distinct positions with minimal compute resources.
Any thoughts?
Thanks
--
Antonio González Peña
Research Assistant, Knight Lab
University of Colorado at Boulder
https://chem.colorado.edu/knightgroup/
It is possible to create one single object, and then to render this
object multiple times by changing the position, rotation, scaling and
then re-rendering the object, etc., You would have to create a single
object, add it to a scene, and then create an array of position,
rotation, scaling descriptor objects for all the "instances" you'd
like to render, and then iterate through that array, set those values
to the sole instance of the model and call scene.render()
systematically. This seems tricky though.
How many objects are you looking to render? What is your exact use
case? Maybe if you let me know better what you'd like to do I can give
you a better response :)
2011/9/9 Antonio González Peña <antg...@gmail.com>:
--
Nicolas Garcia Belmonte - http://philogb.github.com/
Thanks for your reply.
I'm doing some WebGL benchmarking using PhiloGL, my goal is to create
a 3D plot with 3 clusters (an example
http://tmj.ro/articles_images/img7958368951124661.small.jpg), each
cluster will have 33K points and have a specific color, so using this
idea I will have 3 spheres/cubes and 30K position, rotation, scaling
descriptor objects in 3 arrays, right?
Cheers
This is what is done for example in the world flights example with the cities:
http://senchalabs.github.com/philogl/PhiloGL/examples/worldFlights/
All those spheres are just one model made out of all the vertices.
This is faster because it just requires one context and gl call to
render the entire layer. Having to switch contexts and calling gl
calls for each of the 33K elements might not be a good idea.
You can take a look at the world flights example source cod here:
https://github.com/senchalabs/philogl/tree/master/examples/worldFlights
The cities.js file creates that cities layer from all the spheres.
Please let me know if you have any questions on this :)
On Fri, Sep 9, 2011 at 10:56 AM, Nicolas Garcia Belmonte
On Fri, Sep 9, 2011 at 11:57 AM, Nicolas Garcia Belmonte