Arbitrary data matrix input for jit.gl.mesh

Conor Byron's icon

Hello,


Please excuse me if this question has been answered before. I searched the forum but couldn't find an answer.

I'm wondering what the best way would be to set a custom vertex attribute matrix for jit.gl.mesh for use within the shader. For example, say I had the jit.gl.mesh set to '@draw_mode points' and I wanted to specify a matrix with different point_size values for each vertex. I suppose I could re-purpose one of the other matrix inputs such as the edgeflag_matrix, and use the values to size gl_PointSize in the vertex shader, but is there a cleaner way to do this?

Thanks!

Conor

Rob Ramirez's icon

search the File Browser for custom.vertex.attribute.maxpat for an example.

vertex attributes must be tagged in the JXS as state="VERTEX_ATTR" and declared as type attribute.

Then the data is sent via the vertex_attr_matrix message followed by the matrix name.

Conor Byron's icon

Awesome, thank you!