Texture coordinates for triangle fans
<p>I am trying to "fill" a surface of some geometry that I drew. I am using <code>GL_TRIANGLE_FAN</code> primitive. (for example : 1 hub (center) point and 12 other points). I have calculated texture coordinates for each vertex in the interval 0-1. But as a result I get this <img src="https://i.stack.imgur.com/dMxMq.jpg" alt="**image**"> , its a little bit confused. I desire to get result like that <a href="https://i.stack.imgur.com/WoocV.jpg" rel="nofollow noreferrer"><strong>image</strong></a> . Please help, what is wrong here?
How can I calculate correct texture coordinates in such Triangulation ( <code>GL_TRIANGLE_FAN</code> ) 
in the <a href="https://i.stack.imgur.com/vzn9Z.jpg" rel="nofollow noreferrer"><strong>image</strong></a> red dots is my points</p>

<p>*Code - Snippet :</p>

<pre><code> assert(("CROSS type intersection needs only 5 vertices : center point and "
         "rest points in anticlockwise order", (lp-&gt;size() &gt; 5) &amp;&amp; (lp-&gt;size() &lt; 5)));
 osg::Vec3 vAlong_1,vAlong_2;
 vAlong_1 = (*lp)[1] - (*lp)[4];
 vAlong_2 = (*lp)[1] - (*lp)[2];
 eps = ((*lp)[2] - (*lp)[4]).length() * 0.2 / 2;
 vAlong_1.normalize();
 vAlong_2.normalize();

 _edgeCoords-&gt;push_back((*lp)[0]);
 _edgeCoords-&gt;push_back((*lp)[1]);
 if (CMF::euclidDistance((*lp)[0],(*lp)[1]) &lt;= CMF::euclidDistance((*lp)[0],(*lp)[2])) {
    float cosAlpha = -(vAlong_1 * vAlong_2);
    float extraLength = ((*lp)[2] - (*lp)[1]).length() * cosAlpha;
     _edgeCoords-&gt;push_back((*lp)[1] + vAlong_1 * (eps + extraLength));
     _edgeCoords-&gt;push_back((*lp)[2] + vAlong_1 * eps);
 } else {
     float cosAlpha = (vAlong_1 * vAlong_2);
     float extraLength = ((*lp)[2] - (*lp)[1]).length() * cosAlpha;
     _edgeCoords-&gt;push_back((*lp)[1] + vAlong_1 * eps);
     _edgeCoords-&gt;push_back((*lp)[2] + vAlong_1 * (eps + extraLength));
 }
_edgeCoords-&gt;push_back((*lp)[2]);
if (CMF::euclidDistance((*lp)[0],(*lp)[2]) &lt;= CMF::euclidDistance((*lp)[0],(*lp)[3])) {
   float cosAlpha = -(vAlong_1 * vAlong_2);
   float extraLength = ((*lp)[3] - (*lp)[2]).length() * cosAlpha;
    _edgeCoords-&gt;push_back((*lp)[2] - vAlong_2 * (eps + extraLength));
    _edgeCoords-&gt;push_back((*lp)[3] - vAlong_2 * eps);
} else {
    float cosAlpha = (vAlong_1 * vAlong_2);
    float extraLength = ((*lp)[3] - (*lp)[2]).length() * cosAlpha;
    _edgeCoords-&gt;push_back((*lp)[2] - vAlong_2 * eps);
    _edgeCoords-&gt;push_back((*lp)[3] - vAlong_2 * (eps + extraLength));
}
_edgeCoords-&gt;push_back((*lp)[3]);
if (CMF::euclidDistance((*lp)[0],(*lp)[3]) &lt;= CMF::euclidDistance((*lp)[0],(*lp)[4])) {
   float cosAlpha = -(vAlong_1 * vAlong_2);
   float extraLength = ((*lp)[4] - (*lp)[3]).length() * cosAlpha;
    _edgeCoords-&gt;push_back((*lp)[3] - vAlong_1 * (eps + extraLength));
    _edgeCoords-&gt;push_back((*lp)[4] - vAlong_1 * eps);
} else {
    float cosAlpha = (vAlong_1 * vAlong_2);
    float extraLength = ((*lp)[4] - (*lp)[3]).length() * cosAlpha;
    _edgeCoords-&gt;push_back((*lp)[3] - vAlong_1 * eps);
    _edgeCoords-&gt;push_back((*lp)[4] - vAlong_1 * (eps + extraLength));
}
_edgeCoords-&gt;push_back((*lp)[4]);
if (CMF::euclidDistance((*lp)[0],(*lp)[1]) &lt;= CMF::euclidDistance((*lp)[0],(*lp)[4])) {
   float cosAlpha = -(vAlong_1 * vAlong_2);
   float extraLength = ((*lp)[4] - (*lp)[1]).length() * cosAlpha;
    _edgeCoords-&gt;push_back((*lp)[4] + vAlong_2 * eps);
    _edgeCoords-&gt;push_back((*lp)[1] + vAlong_2 * (eps + extraLength));
} else {
    float cosAlpha = (vAlong_1 * vAlong_2);
    float extraLength = ((*lp)[4] - (*lp)[1]).length() * cosAlpha;
    _edgeCoords-&gt;push_back((*lp)[4] + vAlong_2 * (eps + extraLength));
    _edgeCoords-&gt;push_back((*lp)[1] + vAlong_2 * eps);
}
_edgeCoords-&gt;push_back((*lp)[1]);

_tCoords-&gt;push_back(osg::Vec2(0.5,0.5));
_tCoords-&gt;push_back(osg::Vec2(0.666,0.666));
_tCoords-&gt;push_back(osg::Vec2(0.666,1.0));
_tCoords-&gt;push_back(osg::Vec2(0.333,1.0));
_tCoords-&gt;push_back(osg::Vec2(0.333,0.666));
_tCoords-&gt;push_back(osg::Vec2(0.0,0.666));
_tCoords-&gt;push_back(osg::Vec2(0.0,0.333));
_tCoords-&gt;push_back(osg::Vec2(0.333,0.333));
_tCoords-&gt;push_back(osg::Vec2(0.333,0.0));
_tCoords-&gt;push_back(osg::Vec2(0.666,0.0));
_tCoords-&gt;push_back(osg::Vec2(0.666,0.333));
_tCoords-&gt;push_back(osg::Vec2(1.0,0.333));
_tCoords-&gt;push_back(osg::Vec2(1.0,0.666));
_tCoords-&gt;push_back(osg::Vec2(0.666,0.666));
</code></pre>