Hi rrarunan,
the calculation of the tangent vector is not an easy task.
But here is a little piece of GLSL code that shows you how to calculate the tangent and binormal vectors from the vertex normal only:
vec3 tangent;
vec3 binormal;
vec3 c1 = cross( gl_Normal, vec3(0.0, 0.0, 1.0) );
vec3 c2 = cross( gl_Normal, vec3(0.0, 1.0, 0.0) );
if( length(c1)>length(c2) )
{
tangent = c1;
}
else
{
tangent = c2;
}
tangent = normalize(tangent);
binormal = cross(gl_Normal, tangent);
binormal = normalize(binormal);
This piece of code is a part of a forthcoming tutorial.
Hope that will help you!