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.
1 Answer
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 : http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-part-6_25.html
-
\$\begingroup\$ I want my uv mapping being relative to the level, like the inverse of this: stackoverflow.com/questions/1383937/… And my level is bigger than the screen so scroll around. \$\endgroup\$– vshadeDec 10, 2010 at 16:57
-
\$\begingroup\$ I used some multiple of my vertex position to my texture mapping, thanks for the link. \$\endgroup\$– vshadeDec 22, 2010 at 1:44
-
\$\begingroup\$ No problem, glad to have helped. \$\endgroup\$ Dec 23, 2010 at 1:23