Debugging is not particularly fun, but it's an important skill.
.. yes..i did try to debug it and gather much of the data i could with respect to the vertices and texture co-ordinates which are being generated, and trying to make some meaning out of the data.
though i think the code area:
//get the hill texcoordinates
for(short i = 0; i < MAX_SEGMENTS; ++i)
//calculating texture co-ordinates
CCPoint pt = hillBottomVertices[i];
hillBottomTexCoords[i] = pt * (1.0f / terrainBottomTexSize);
hillBottomTexCoords[i].y = 1.0f - hillBottomTexCoords[i].y;
CCLOG("point: %f %f", hillBottomTexCoords[i].x, hillBottomTexCoords[i].y);
the texture coordinates values are like
point: 0.937500 0.594344
point: 0.937500 1.000000
point: 1.093750 0.565063
point: 1.093750 1.000000
point: 2.031250 0.347375
point: 2.031250 1.000000 ...so on
point: 166.875000 0.280531
point: 166.875000 1.000000 ... till
point: 260.937500 0.308594
point: 260.937500 1.000000 .. until the X co-ordinates goes beyond 256 which is also the size of the texture(size = 256) ..that the stretch starts to appear.
As i move ahead the x co-ordinates keeps on increasing and the texture goes on stretching more.
Edited by anupgupta, 30 April 2014 - 10:05 AM.