gl3: tangent and bitangent vertex attributes not working?
Hi everybody,
I built a patch to calculate tangent and bitangent of a mesh given the position of the vertices, UV coordinates and vertex normals. I'm passing those attributes to a jit.gl.mesh object in order to make something out of them, but in the vertex shader i cannot read them.
I'm accessing the attributes as follows:
<param name="T" type="vec3" state="TANGENT" />
<param name="B" type="vec3" state="BITANGENT" />
...
<bind param="T" program="vp" />
<bind param="B" program="vp" />
...
in vec3 T;
in vec3 B;
...
jit_out.color = vec4(T, 1.);
As i visualize one of these vectors as color for debugging, weird things happen...
The shader does compile but i see pure black or worse i see the colors of the vector previously assigned to jit_out.color variable.
I have no problem visualizing vertex position, texcoords and normals the same way, but i don't get why it shouldn't work with tangents and bitangents. I'm shure the provided matrices are 3 plane, have the same type and dimension of the vetrex position matrix, they contain both positive and negative values and connecting them to jit.pwindow objects I "see stuff". I also tried to pass the vertex attributes trough [jit.gl.buffer @type tangent] objects and to connect the matrices to the first inlet of jit.gl.mesh with [prepend tengent_matrix], but i get the same behaviour.
If i write tangents and bitangents into a lookup texture i can normally read them inside the vertex shader.
What am I getting wrong?
I'm on OSX, Max 8.1.5, gl3 engine enabled.
Thanks! I can provide the patch, if needed.