Can't draw in color?

Can't draw in color?
0

#1

I was debugging an issue where I couldn’t use DebugDraw for Box2d. Turns out… I couldn’t see my shapes because regardless of what color the shapes were being drawn in in the DebugDraw code… they only get drawn as black. Black on black means you can’t see any shapes. :wink:

Anyways I did some experimenting with the HelloWorld example. I changed the parent class to be CCLayerColor instead of CCLayer so I could set my background color to something other than black.

I then put some simple OpenGL code in my draw call to see what would happen.
It worked… but again only black. Even if I change the color via the proper glColor* function it still only shows up as black.

What am I missing?

Here’s my draw call:
`void HelloWorld::draw()
{
CCLayerColor::draw();
ccGLEnableVertexAttribs(kCCVertexAttribFlag_Position);
kmGLPushMatrix();

// Try drawing in red
glColor4f(1.0, 0.0, 0.0, 1.0);

glBegin(GL_TRIANGLES); // Drawing Using Triangles
glVertex3f( 0.0f, 200.0f, 0.0f); // Top
glVertex3f( 0.0f, 0.0f, 0.0f); // Bottom Left
glVertex3f( 200.0f, 0.0f, 0.0f); // Bottom Right
glEnd() // Finished Drawing The Triangle

kmGLPopMatrix();
}
`