如何用cocos2d绘制一个实心圆圈的iPhone [英] How to draw a solid circle with cocos2d for iPhone

查看:361
本文介绍了如何用cocos2d绘制一个实心圆圈的iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以用cocos2d绘制一个圆圈吗?
使用drawCircle()函数可以完成一个圆圈,但是有办法以某种颜色填充它吗?

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 by using pure OpenGL?

推荐答案

在DrawingPrimitives.m中,在drawCricle中更改:

In DrawingPrimitives.m, change this in drawCricle:

glDrawArrays(GL_LINE_STRIP, 0, segs+additionalSegment);

到:

glDrawArrays(GL_TRIANGLE_FAN, 0, segs+additionalSegment);

您可以在这里阅读更多有关opengl原语的信息:
http://www.informit.com/articles/article.aspx?p=461848

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

这篇关于如何用cocos2d绘制一个实心圆圈的iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆