0

Im working in an app using cocos2D and want to know how to apply a texture to a line or a bezier line (ccDrawRect and ccDrawCubicBezier respectively). My draw code is so easy :

ccDrawColor4F(_r, _g, _b, _a);
glLineWidth(_g_iLineWidth);
ccDrawCubicBezier (...);

I want just to know how to apply a 2D texture to this line. Ive got my line texture in png format and want to apply it by repeating the texture along the curve.

Thank you very much in advance! Regards

AlfuryDB
  • 289
  • 1
  • 4
  • a line can't have a texture, you'll need a polygon (strip) – CodeSmile May 20 '13 at 19:52
  • You probably are right, but I need to apply a texture to a Bezier Curve. Ive seen this project: https://github.com/haqu/climbers and I think the line is not a polygon, sorry, Im not an expert in opengl. Thank you – AlfuryDB May 23 '13 at 10:33
  • uhm, you have the reference right there! https://github.com/haqu/climbers/blob/master/VerletRope/VRope.mm uses line drawing, and the code also uses regular sprites though I'm not sure what for – CodeSmile May 23 '13 at 19:01
  • I forget to reply I finally didnt use a texture. Anyway, thank you very much! – AlfuryDB Jul 02 '13 at 11:28
  • Hi there, I'm trying to achieve something similar. You said that you didn't use texture, then how did you accomplish this? thanks – lionserdar Jul 09 '14 at 15:43
  • Probally he used a different approach, like replace the texture effect with multiple lines of different colors. This is the way I solved this problem. – Joe Aspara Apr 05 '15 at 22:46

0 Answers0