Generating and managing GL shapes

    Jun 17 2014 | 11:29 pm
    Help me conceptualise something. I'm trying to do the following:
    A bang generates a 3D shape (a cube) which will animate for a while, time out and then die. Any number of 3D shapes can be generated independent of each other.
    There is vishnu/shiva but not good if I want to be flexible with the 3D shape so I'm thinking of a inside a poly~. I'm worried about memory with this though (something which vishnu/shiva does for you). I guess I can't go on adding a 'voice' to poly~ indefinitely and is there even a way to delete 'voices' as you go? So I guess I'd need to keep track of each voice and when it times out reuse it for a new voice. Everything up to this I'm fine with but keeping track of the voices has stumped me and it kind of all seems very inefficient, all those in poly's, is this solution a good one or is there a better one (no javascript solutions please)? If it seems viable how I might I keep track of the voices?
    Not necessarily looking for code just tips on how this might be done.
    thanks Garrett

    • Jun 18 2014 | 3:49 pm
      i'm not sure why you think the jit.p.* objects won't allow you to be flexible the the 3d shape. they simply output matrices, which can be position values for anything.
      the conventional solution is to use jit.p with, and the 3d shape can be anything that is compatible with you can enable/disable shapes using the scale parameter.
      if this isn't flexible enough for you, then yes, poly~ or javascript are the next solutions.
      i wouldn't worry about dynamically changing the number of voices. simply allocate the most you will ever need, and use the @enable attribute to turn shapes on and off.
      here's a little patch demonstrating the p objects with gl.multiple and gl.model: