50,50), Vec2(100,50), Vec2(100,100), Vec2(50,100) };
DrawPrimitives::drawPoly( vertices, 5, false);//左下角的方形
CHECK_GL_ERROR_DEBUG();
// filled poly
glLineWidth(1);//五角星
Vec2 filledVertices[] = { Vec2(0,120), Vec2(50,120), Vec2(50,170), Vec2(25,200), Vec2(0,170) };
DrawPrimitives::drawSolidPoly(filledVertices, 5, Color4F(0.5f, 0.5f, 1, 1 ) );
// closed purble poly
DrawPrimitives::setDrawColor4B(255, 0, 255, 255);
glLineWidth(2);
Vec2 vertices2[] = { Vec2(30,130), Vec2(30,230), Vec2(50,200) };
DrawPrimitives::drawPoly( vertices2, 3, true);
CHECK_GL_ERROR_DEBUG();
// draw quad bezier path 中间这条线
DrawPrimitives::drawQuadBezier(VisibleRect::leftTop(), VisibleRect::center(), VisibleRect::rightTop(), 50);
CHECK_GL_ERROR_DEBUG();
// draw cubic bezier path 上面的线
DrawPrimitives::drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x+30,VisibleRect::center().y+50), Vec2(VisibleRect::center().x+60,VisibleRect::center().y-50),VisibleRect::right(),100);
CHECK_GL_ERROR_DEBUG();
//draw a solid polygon
Vec2 vertices3[] = {Vec2(60,160), Vec2(70,190), Vec2(100,190), Vec2(90,160)};
DrawPrimitives::drawSolidPoly( vertices3, 4, Color4F(1,1,0,1) );
// restore original values
glLineWidth(1);
DrawPrimitives::setDrawColor4B(255,255,255,255);
DrawPrimitives::setPointSize(1);
CHECK_GL_ERROR_DEBUG();
//end draw
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}
?
西。
const Vec2& center,
float radius,
float angle,---------这个参数有什么用?没看懂,测试了也感觉不出区别。。终于找到了,相对于x轴正方向旋转方向。比如:从90*pi/180度即y轴正方向与圆交点的位置
unsigned int segments,:圆边被切成多少段线段
bool drawLineToCenter:圆心到起始绘制点是否绘制线段
?
?
void drawCircle( const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
{
drawCircle(center, radius, angle, segments, drawLineToCenter, 1.0f, 1.0f);
} ?
?
?