Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to draw a terrain for a 2d game, and this terrain is defined by some rotated rectangles and circles, I want to draw my terrain as if it was a repeating texture clipped by those forms. I already modified the cocos2d draw primitives methods to draw them using a triangle fan, but I'm not sure how to apply a texture on them.

share|improve this question
up vote 2 down vote accepted

Very difficult to make out what it is you are asking from this question.

1) The one thing you might allude to would be the UV wrap mode on a mesh. You bind the texture, render the mesh (of course, depending on ES2.0 shaders or fixed function ES1.1), and make sure the wrap mode is set to repeat, not clamp.

Also, for more thorough information, read this page :

share|improve this answer
I want my uv mapping being relative to the level, like the inverse of this:… And my level is bigger than the screen so scroll around. – vshade Dec 10 '10 at 16:57
I used some multiple of my vertex position to my texture mapping, thanks for the link. – vshade Dec 22 '10 at 1:44
No problem, glad to have helped. – underscorediscovery Dec 23 '10 at 1:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.