I found the tests for the beta here: http://www.cocos2d-x.org/reference/native-cpp/V3.0alpha0/d1/d89/namespacecocos2d_1_1_draw_primitives.html#a196155c1b3410485d0b77379acf22e64
I created a simple test class to test it:
#ifndef __ccxtest__DrawTest__
#define __ccxtest__DrawTest__
#include <iostream>
#include "cocos2d.h"
class DrawTestLayer : public cocos2d::Layer
{
public:
CREATE_FUNC(DrawTestLayer);
protected:
void draw();
};
#endif /* defined(__ccxtest__DrawTest__) */
And the implementation:
#include "DrawTest.h"
USING_NS_CC;
void DrawTestLayer::draw()
{
glLineWidth(1);
DrawPrimitives::setDrawColor4B(255,255,255,255);
DrawPrimitives::setPointSize(1);
// Anti-Aliased
glEnable(GL_LINE_SMOOTH);
// filled poly
glLineWidth(1);
Point filledVertices[] = { Point(10,120), Point(50,120), Point(50,170), Point(25,200), Point(10,170) };
DrawPrimitives::drawSolidPoly(filledVertices, 5, Color4F(0.5f, 0.5f, 1, 1 ) );
}
Finally in the init of the parent scene/layer:
auto myLayer = DrawTestLayer::create();
this->addChild(myLayer);
And the result is a 5 point polygon. I tested this on a generic hello world project, and the background image, colors, fonts, etc showed through.
Edit: how to show/hide the drawing:
void DrawTestLayer::draw()
{
if ( drawFlagBoolean ) // controlled by timer or scheduled action
{
// draw code here
// every frame primitives are drawn
}
}