A quick look at the code suggests these lines are the problem:
v4=AddVertex(ShapeSurface,TempX,TempY,TempZ)
VertexTexCoords ShapeSurface, v4,TempX,TempY
You are using the same values (TempX, TempY) for vertex positions and for texture coordinates.
Position values can be anything. But texture U,V values should generally be in the range of 0 to 1.
A (U,V) of (0,0) is the upper left corner of the texture and (1,1) is the lower right. Thus ( 0.1, 0.9 ) would be a little to the right and above the lower left corner.
Unless you specify otherwise the U,V values wrap 'modulo 1'. For example, U values of 0.3, 1.3, 2.3 etc. all denote the same location.
v4=AddVertex(ShapeSurface,TempX,TempY,TempZ)
VertexTexCoords ShapeSurface, v4,TempX,TempY
You are using the same values (TempX, TempY) for vertex positions and for texture coordinates.
Position values can be anything. But texture U,V values should generally be in the range of 0 to 1.
A (U,V) of (0,0) is the upper left corner of the texture and (1,1) is the lower right. Thus ( 0.1, 0.9 ) would be a little to the right and above the lower left corner.
Unless you specify otherwise the U,V values wrap 'modulo 1'. For example, U values of 0.3, 1.3, 2.3 etc. all denote the same location.