jit.gl.mesh thinks every color is black
Hi,
I've been (once again) embarrassed by lack of understanding of mesh coloring.
I'm aware of this: "Planes 0-2 specify the x, y and z position of the vertex. Planes 3 and 4 specify the texture co-ordinates s and t. Planes 5-7 specify the normal vector nx, ny and nz used to calculate the effects of lighting on the geometry. Planes 8-11 specify the red, green, blue, and alpha vertex color. Plane 12 specifies the edge flag e."
OK, so I do a jit.unpack and put planes 8-11 (counting from 0) into a jit.pack 4, and put that into the color array input of jit.gl.mesh. I get: black. jit.cellblock shows me that this color array is actually 0.5 0.5 0.5 1.0, but jit.gl.mesh draws: black.
I've tried putting the rest of the matrix output into the other jit.gl.mesh inputs, but the only thing that will ever draw colors for me is auto_color 1. But I don't want auto_color; I want to control the color.
(gl_color doesn't work either.)
What am I missing?
Thanks, hjh
You're doing nothing wrong regarding the colors. (0.5 0.5 0.5 1) is a neutral grey and that's how [jit.gl.mesh] draws the points.
Change those values with [jit.gen] or however you want and you'll see colors.
One mistake I spotted in your patch is that you sent the entire 12 planes matrix from [jit.gl.gridshape] to [jit.gl.mesh] to your [jit.gen waves], so you're basically sending two times all 12 planes to [jit.gl.mesh] while I assume you just want to set the position matrix with that jit.gen. You could jit.pack the 3 first outlets of your [jit.unpack], but instead I preferred to use [jit.unpack 4 @jump 3 2 3 4 @offset 0 3 5 8] which will unpack the 12 planes matrix into the right matrices without needing to [jit.pack] after that.
> One mistake I spotted in your patch is that you sent the entire 12 planes matrix from [jit.gl.gridshape] to [jit.gl.mesh] to your [jit.gen waves], so you're basically sending two times all 12 planes to [jit.gl.mesh]
Ohhhh right... and, now I get it: the unpack is working right to left, so first it's putting in colors that I want, and then overwriting that with the 12 plane matrix coming through jit.gen (which is also not populating anything after the first three planes, hence, color = 0 0 0 0).
That does make sense. Thanks!
hjh