CCDrawNode seems to not get colors correctly.
Any value of ccColor4F higher than 0.0f seems to be interpreted as a full 1.0f; you can only get pure red, green, blue or any combination of these, but not a gray, for example.
The following code produces the image attached.
bool MyLayer::init()
{
CCPoint vertex[] = { ccp(0,0), ccp(100,0), ccp(100,100), ccp(0,100) };
if( CCLayer::init() )
{
CCDrawNode *dnode = CCDrawNode::create();
// the fill color should not be pure yellow!!
// the border should NOT be white!!
dnode->drawPolygon( vertex, 4, ccc4f(0.1f, 0.1f, 0, 1), 4, ccc4f(0.1f, 1, 0.1f, 1) );
// this way does not work either. Pure white is displayed
ccColor4F gray = {0.5f, 0.5f, 0.5f, 1.0f };
dnode->drawSegment( ccp(0,0), ccp(200,200), 4, gray );
dnode->setPosition( VisibleRect::center() );
this->addChild( dnode );
return true;
}
else
{
return false;
}
}
Does anyone know what is happening?
ccdrawnode.jpg (9.5 KB)