Forums > Jitter

Generating and managing GL shapes

June 17, 2014 | 4:29 pm

Hi

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 jit.gl.sketch 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 jit.gl.sketches 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


June 18, 2014 | 8:49 am

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 jit.gl.multiple, and the 3d shape can be anything that is compatible with jit.gl.multiple. 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:

– Pasted Max Patch, click to expand. –

Viewing 2 posts - 1 through 2 (of 2 total)