how to color jit.gl.sketch based stuff multiplied by jit.gl.multiple ?

Julien Bayle's icon

hello,
I'm drawing very basic shape using jit.gl.sketch.
these latter are used with jit.gl.multiple
position, scale are okay.

I have a problem to color them using a color_matrix feeding jit.gl.multiple
I tried to specify glcolor or not in the commands passed to jit.gl.sketch ... all the same.

is there an alternative to jit.gl.sketch to draw very basic lines ?
is there another way ?

any leads would be interesting for me.

Rob Ramirez's icon

drawing basic lines can be done with jit.gl.mesh @drawmode lines or jit.gl.path.

Julien Bayle's icon

I guess my problem is a double problem.
As you mentioned, mesh drawing seems to be my way here (for other reason)
But I am still not okay with coloring stuff using jit.gl.multiple. my jit.gl.mesh instances "multiplied" by jit.gl.multiple remain grey.

Julien Bayle's icon

I'm okay without jit.gl.mesh to color gridshape using the required float32 RGBA matrix feeding jit.gl.multiple.

I don't know why I cannot color jit.gl.sketch through a color matrix feeding the gl multiple
and it is the same with jit.gl.path.
I'm missing something probably like the elephant inside the room...

Rob Ramirez's icon

post your patch

Julien Bayle's icon
Max Patch
Copy patch and select New From Clipboard in Max.

here it is, Rob.

Rob Ramirez's icon

ok, the reason the gl.mesh is ignoring the color values from gl.multiple, is because you are sending it color planes from jit.gl.gridshape.

jit.gl.gridshape outputs a 12 plane matrix when matrixouput is enabled. planes 9-12 are color info, causing gl.mesh to ignore color from gl.multiple. if you don't pass these color planes, it will work as expected.

simply insert a "jit.pack 1 @jump 8" between the gl.gridshape and the gl.mesh. this will pass only the first 8 planes (3 position, 2 texcoord, and 3 normals).

jit.gl.sketch won't work with gl.multiple colors, due to the way the object draws itself.

matmat's icon
Max Patch
Copy patch and select New From Clipboard in Max.

hi,
there is a solution a bit tricky ;
remove "glcolor" message to sketch;
replace "color" to "attr.color" on multiple object
:)

Julien Bayle's icon

Thanks Rob and matmat.
Ok for the 12 plane matrix, I knew it, I got it in this case.
I didn't know about attr.color. This sounds the way to control each object color.

THANKS a lot.

benjisugar's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hey all!
I'm having a similar issue. I tried using "attr.color" instead of color but it still won't do the trick. Could you help me out here please?

matmat's icon
Max Patch
Copy patch and select New From Clipboard in Max.

hi
for your patch you don't need to use "attr.color", you can simply use "color"

steprec's icon

Hello,

I am having a problem down on this line. I am trying to map the colors of a gridshape onto the multiple object (to control an led setup) but i just can't seem to get it right. I can map the 2d matrix onto the multiple object, which would multiple that, but not the actual 3d color values. What are your thoughts on that? What am i missing?

Las

multipleleds.maxpat
Max Patch
Rob Ramirez's icon

can you explain a little more what you're trying to achieve? it's not clear from the patch you posted.

dunk's icon

Thanks MATMAT - your nine year old advice just saved me quite the headache