我正在覆盖CCLayerColor的绘制方法来绘制边框,但颜色不会改变。我试过ccDrawXxxx,他们都只使用白色作为颜色。我也试过glColor4ub
同样的效果。这就是我在绘制方法中的全部内容:
CGSize selfSize = [self contentSize];
float selfHeight = selfSize.height;
float selfWidth = selfSize.width;
CGPoint vertices[4] = {ccp(0.f, 0.f), ccp(0.f, selfHeight), ccp(selfWidth, selfHeight), ccp(selfWidth, 0.f)};
glColor4f(0, 0, 1.0f, 1.0f);
glLineWidth(4.0f);
ccDrawPoly(vertices, 4, YES);
我错过了什么吗?我正在使用v2.0。
答案 0 :(得分:0)
这应该有效:
ccDrawColor(1, 0, 0, 1);
ccDrawSomething(…);
您不应该在cocos2d 2.0中使用GLES 1.1方法,如glColor4f和glLineWidth。也许这会通过导致OpenGL错误以某种方式影响GL状态。