How can I draw custom colors in Cocos2d-x draw function?

151 Views Asked by At

I am using Cocos 2.2.6 (the latest 2.x release shown on their site). (I have to use 2.x for business purposes)

I know how to draw shapes in opengl and how to color them, but unfortunately what I am trying to do is not working exactly.

I am trying to give color to vertices with glColor3f and glColor4f but they just show up as monochrome. I tried to enable disable material, lighting etc.. nothing worked.. Is there a filter or something? If so how can I disable it so I can use my own colors in a glPush/glPop block. If not, what should I do?

Thanks!

Update 1:

void Hey::draw()
{
    glBegin(GL_LINES);
    glColor4f(0, 1, 0,1);
    glVertex2f( a.x, a.y );
    glColor4f(0, 1, 0,1);
    glVertex2f( b.x, b.y );
    glEnd();
}
0

There are 0 best solutions below