Geo Paul
Geo Paul

Reputation: 1817

Cocos2d Mac ccDrawLine color

I am using cocos2d for mac. I have overloaded the ccdrawline of a CCLayer subclass inorder to draw a line. It works fine. To change the color to red I use glColor4f(1.0f,0,0,1.0f);

but whatever value I gave to the glColor4f the color does not change. It remains white. but I noticed that other openGL functions such as glLineWidth(5.0f) are working correctly!.

Upvotes: 0

Views: 1468

Answers (1)

JTea
JTea

Reputation: 234

If you're on cocos2d 2.x you can use:

void ccDrawColor4F( GLfloat r, GLfloat g, GLfloat b, GLfloat a );

as defined in CCDrawingPrimitives.h.

Though as phix23 pointed out it's a global function, so you can use it straight away.

Upvotes: 3

Related Questions