..why would you divide by CC_CONTENT_SCALE_FACTOR for the top texture and multiply by it instead for the bottom texture?
my bottom texture image size was 512x512 and top texture size was 32x32 .. that i did to scale down the textures to make it look appropriate on the screen.
Actually, there is a location in getTerrainNextPoint which is IMO problematic: Therein you continuously add 200 onto a float variable (namely the x co-ordinate of the terrain control points). I have no clue with which rate this is done
just roughly what i am doing is i have calculated 10 points(MAX_HILL_POINTS) which are 200 pixels apart of each other and then divided the whole 10 points into 100 segments (MAX_SEGMENTS)..and then in the update i keep checking if the points go outside screen then delete the point from the left and then add one point to the right and recalculate the terrain and thus this gives me endless terrain. the new point which is added is also 200 pixels apart in x and random in y in a given range. and the cardinal spline algorithm gives me a smooth curve across points(100 segments). i guess the issue could be in the generatecoordinates() function..but am not sure and need help to understand it.
the 200 is added only when one point is deleted and when the next is added..thus every point added is 200 pixel apart in X direction and random in Y direction between a set range.
checking of all the 10 points is done every frame if any of the point is gone outside screen, and if it goes outside the screen then delete the point and add a new point as the next point (getTerrainNextPoint) to the hill points array and then recalculate the whole terrain again and map the texture on it. thus with only 10 points divided into 100 segments i get a constantly generated terrain which is endless.
?generally, though i have now tried to follow a tutorial for texture mapping on the terrain and i revised my code..here is the link : http://www.codeproject.com/Articles/727918/d-Textures-in-cocos-d-x-V
but the problem remains as it is..the terrain bottom texture still gets stretched even after implementing this tutorial.
Attaching the revised code ([attachment=21149:terrain.zip]) for your reference and to get some inputs for this query.
Please suggest something or if you have a better way of doing it do let me know. .. the problem i am facing is in texture mapping. i guess
[attachment=21147:IMG_0181.png] [attachment=21148:IMG_0186.png]