How to apply a color to jit.gl.mesh instead of jit.gl.gridshape?

Jean-Francois Charles's icon

When I create a geometry with [jit.gl.mesh], I can change the rendered scale and position by scale and position messages to [jit.gl.mesh]. I don't manage to change the color this way. Would someone explain how I could override the color coming from a [jit.gl.gridshape] for instance?

I tried to unpack the geometry matrix to keep only the first 3 planes, but wasn't successful.

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks for any pointer.

carsol's icon

you feed the gl.mesh with the 12 planes output of the gridshape and 4 of these planes are the ones related to color.... if you add in between a [jit.unpack 1 @offset 0 @jump 2] then only the 3 vertex planes are passed to the mesh and you will be able to play with the color attr of the gl.mesh object.... but you will loose normals and textcoords too...

you can color also the mesh, feeding a matrix in the 4th mesh inlet... this way is per vertex...

check this > https://www.youtube.com/watch?v=_OC9HOYtsyI

Jean-Francois Charles's icon

Great, thanks! (plus I learnt about the jump attribute for [jit.unpack]...)

Rob Ramirez's icon

just to add a bit more clarity, if you only want to chop off the color planes from gridshape, but keep position, texcoord, and normals, simply send gridshape matrix through jit.pack 1 @jump 8 (telling it to only output 8 planes from the input matrix).

Jean-Francois Charles's icon

Yes, that's quite clear, thanks!