I use cocos2d and i draw circles like this
- (void)draw:(Ball*)ball {
glLineWidth(1);
ccDrawColor4F(255 / 255.0f, 0 / 255.0f, 0 / 255.0f, 200 / 255.0f);
ccDrawCircle(ball._center, ball._radius, CC_DEGREES_TO_RADIANS(ball._angle), ball._segments, NO);
ball._center = CGPointMake(ball._center.x + ball._directionX, ball._center.y + ball._directionY);
}
this is a state of the ball where i increase the center so it can move. This produce red border circles but i want to fill the circles with come color and alpha.
I also tried to subclass the CCSprite class and call
self.color = ccc3(200 / 255.0f, 0 / 255.0f, 0 / 255.0f);
in the init method but again only the border of the circle gets color.
So my question is how to fill a circle with color, what am i missing?
to set opacity try this
from http://www.cocos2d-x.org/boards/6/topics/5868
void CMySprite::draw()
{
// is_shadow is true if this sprite is to be considered like a shadow sprite, false otherwise.@
if (is_shadow)
{
ccBlendFunc blend;
// Change the default blending factors to this one.
blend.src = GL_SRC_ALPHA;
blend.dst = GL_ONE;
setBlendFunc( blend );
// Change the blending equation to thi in order to subtract from the values already written in the frame buffer
// the ones of the sprite.
glBlendEquationOES(GL_FUNC_REVERSE_SUBTRACT_OES);
}
CCSprite::draw();
if (is_shadow)
{
// The default blending function of cocos2d-x is GL_FUNC_ADD.
glBlendEquationOES(GL_FUNC_ADD_OES);
}
}