How to draw a solid circle with cocos2d for iPhone

后端 未结 6 1795
遇见更好的自我
遇见更好的自我 2021-02-02 15:53

Is it possible to draw a filled circle with cocos2d ? An outlined circle can be done using the drawCircle() function, but is there a way to fill it in a certain color? Perhaps b

6条回答
  •  不知归路
    2021-02-02 16:18

    In DrawingPrimitives.m, change this in drawCricle:

    glDrawArrays(GL_LINE_STRIP, 0, segs+additionalSegment);
    

    to:

    glDrawArrays(GL_TRIANGLE_FAN, 0, segs+additionalSegment);
    

    You can read more about opengl primitives here: http://www.informit.com/articles/article.aspx?p=461848

    alt text

提交回复
热议问题