jit.gl.gridshape – independent colors per object?

Jun 27, 2006 at 4:13pm

jit.gl.gridshape – independent colors per object?

Hello:

I’ve been doing some work with jit.gl.gridshape using matrix input. I’m rendering multiple 3d spheres at once. It is quite easy (thanks to much help and a nice demo by Andrew) to manipulate many aspects of each of these spheres independently (e.g. scale, position, etc.), but I’m pretty sure that any color changes will be applied to all objects of a given jit.gl.gridshape.

I’m just wondering if anyone knows of a way to manipulate color independently under these circumstances. Here is a more clear breakdown:

Using various messaging combined with jit.poke, I feed a matrix (jit.matrix name 4 float32 32) with changing data, which is then fed into jit.gl.gridshape as various parameters. This gives me independent contol over many aspects of 32 GL spheres. The only problem is…any color messages apply to all 32 spheres.

Can anybody spot a workaround? Right now I just have to use a different jit.gl.grishape for each color.

Thanks in advance,

Paul

#26586
Jun 27, 2006 at 4:25pm

If you are using one jit.gl.gridshape object to draw multiple times
with automatic=0, you can set the color differently for each sphere
just like any other parameter.

-Randy

On Jun 27, 2006, at 9:13 AM, Paul wrote:

>
> Hello:
>
> I’ve been doing some work with jit.gl.gridshape using matrix
> input. I’m rendering multiple 3d spheres at once. It is quite
> easy (thanks to much help and a nice demo by Andrew) to manipulate
> many aspects of each of these spheres independently (e.g. scale,
> position, etc.), but I’m pretty sure that any color changes will be
> applied to all objects of a given jit.gl.gridshape.
>
> I’m just wondering if anyone knows of a way to manipulate color
> independently under these circumstances. Here is a more clear
> breakdown:
>
> Using various messaging combined with jit.poke, I feed a matrix
> (jit.matrix name 4 float32 32) with changing data, which is then
> fed into jit.gl.gridshape as various parameters. This gives me
> independent contol over many aspects of 32 GL spheres. The only
> problem is…any color messages apply to all 32 spheres.
>
> Can anybody spot a workaround? Right now I just have to use a
> different jit.gl.grishape for each color.
>
> Thanks in advance,
>
> Paul
>

#79725
Jun 27, 2006 at 4:29pm

You can change the color – you’ll have to set “@automatic 0″ and send
a bang after sending the parameters for drawing each sphere, like
“scale 1. 1. 1., color 2. 2. 2. 2., bang, scale 1. 1. 1., color 2. 2.
2. 2., bang”

see:

#P window setfont “Sans Serif” 9.;
#P window linecount 4;
#P message 168 117 187 196617 scale 0.2 0.2 0.2 , position 0. 0.2
0.1 , color 0.2 0. 0.8 1. , bang , scale 0.3 0.3 0.3 , position
0.2 -0.1 0. , color 0.9 0.9 0. 1. , bang;
#P window linecount 1;
#P newex 167 178 185 196617 jit.gl.gridshape spherage @automatic 0;
#P newex 49 78 182 196617 t b b erase;
#P toggle 49 23 15 0;
#P newex 49 54 57 196617 qmetro 22;
#P newex 49 118 108 196617 jit.gl.render spherage;
#P window linecount 2;
#P newex 49 168 101 196617 jit.window spherage @depthbuffer 1;
#P connect 4 1 6 0;
#P fasten 4 2 1 0 226 102 54 102;
#P connect 2 0 4 0;
#P connect 4 0 1 0;
#P connect 6 0 5 0;
#P connect 3 0 2 0;
#P window clipboard copycount 7;

On Jun 27, 2006, at 5:13 PM, Paul wrote:

>
> Hello:
>
> I’ve been doing some work with jit.gl.gridshape using matrix
> input. I’m rendering multiple 3d spheres at once. It is quite
> easy (thanks to much help and a nice demo by Andrew) to manipulate
> many aspects of each of these spheres independently (e.g. scale,
> position, etc.), but I’m pretty sure that any color changes will be
> applied to all objects of a given jit.gl.gridshape.
>
> I’m just wondering if anyone knows of a way to manipulate color
> independently under these circumstances. Here is a more clear
> breakdown:
>
> Using various messaging combined with jit.poke, I feed a matrix
> (jit.matrix name 4 float32 32) with changing data, which is then
> fed into jit.gl.gridshape as various parameters. This gives me
> independent contol over many aspects of 32 GL spheres. The only
> problem is…any color messages apply to all 32 spheres.
>
> Can anybody spot a workaround? Right now I just have to use a
> different jit.gl.grishape for each color.
>
> Thanks in advance,
>
> Paul

#79726
Jun 27, 2006 at 4:33pm

Hi Paul,
Can you post your patch? Your message is quite confisuing as
jit.gl.gridshape doesn’t take a matrix input, so I’m not quite sure
what you’re talking about. You can in fact render multiple gridshapes
using one object with different colors with messages. Just set it to
@automatic 0 and set all the parameters you want to change and then
send a draw message. Repeat for each bang to jit.gl.render for
however many distinct gridshapes you want to appear.

Alternatively if you’re on OSX and want to use matrices with
jit.poke~, you can download the new UB beta and use the
jit.gl.multiple object to render many gridshapes at once with varying
values for things like position, scale, color, texture, etc.

best,
wes

On 6/27/06, Paul

wrote:
>
> Hello:
>
> I’ve been doing some work with jit.gl.gridshape using matrix input. I’m rendering multiple 3d spheres at once. It is quite easy (thanks to much help and a nice demo by Andrew) to manipulate many aspects of each of these spheres independently (e.g. scale, position, etc.), but I’m pretty sure that any color changes will be applied to all objects of a given jit.gl.gridshape.
>
> I’m just wondering if anyone knows of a way to manipulate color independently under these circumstances. Here is a more clear breakdown:
>
> Using various messaging combined with jit.poke, I feed a matrix (jit.matrix name 4 float32 32) with changing data, which is then fed into jit.gl.gridshape as various parameters. This gives me independent contol over many aspects of 32 GL spheres. The only problem is…any color messages apply to all 32 spheres.
>
> Can anybody spot a workaround? Right now I just have to use a different jit.gl.grishape for each color.
>
> Thanks in advance,
>
> Paul
>

#79727
Jun 27, 2006 at 5:05pm

Thanks guys,

The spheres are only a small part of a large and very messy patch (my first Max/MSP/Jitter project). I couldn’t ask you to sort it out. However unclear my description was, you’ve managed to answer expertly. Thank you very much. My problem seems to have been with the message/bang ordering. I was getting weird constant flickering when I would change colors. I’ll implement your advice and see what happens.

Also, as you say, I mispoke when I called it “matrix input.” I should have said that I was using a matrix to supply parameters for jit.gl.gridshape. Here is a breakdown of the flow:

*multiple jit.poke objects—–> Matrix with 4 dimensions(x,y,z,scale)—–> jit.iter—–> messages (like position $1 $2 $3 and scale $4 $4 $4——-> jit.gl.gridshape)

Sorry about that. Thanks for the help. If I have further questions, I’ll be sure to prepare a smaller patch that demonstrates the issue at hand.

Best,

P

#79728

You must be logged in to reply to this topic.