mirror of https://github.com/axmolengine/axmol.git
fill for polygon drawing
This commit is contained in:
parent
41bdb281dc
commit
d23b044782
|
@ -136,8 +136,10 @@ void ccDrawLine(CCPoint origin, CCPoint destination)
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
void ccDrawPoly(const CCPoint *poli, int numberOfPoints, bool closePolygon)
|
||||
void ccDrawPoly(const CCPoint *poli, int numberOfPoints, bool closePolygon){
|
||||
ccDrawPoly(poli,numberOfPoints,closePolygon,false);
|
||||
}
|
||||
void ccDrawPoly(const CCPoint *poli, int numberOfPoints, bool closePolygon, bool fill)
|
||||
{
|
||||
ccVertex2F* newPoint = new ccVertex2F[numberOfPoints];
|
||||
if (! newPoint)
|
||||
|
@ -190,11 +192,11 @@ void ccDrawPoly(const CCPoint *poli, int numberOfPoints, bool closePolygon)
|
|||
|
||||
if( closePolygon )
|
||||
{
|
||||
glDrawArrays(GL_LINE_LOOP, 0, (GLsizei)numberOfPoints);
|
||||
glDrawArrays(fill? GL_TRIANGLE_FAN : GL_LINE_LOOP, 0, numberOfPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)numberOfPoints);
|
||||
glDrawArrays(fill? GL_TRIANGLE_FAN : GL_LINE_STRIP, 0, numberOfPoints);
|
||||
}
|
||||
|
||||
// restore default state
|
||||
|
|
|
@ -63,6 +63,11 @@ The polygon can be closed or open
|
|||
*/
|
||||
void CC_DLL ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon );
|
||||
|
||||
/** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points.
|
||||
The polygon can be closed or open and optionally filled with current GL color
|
||||
*/
|
||||
void CC_DLL ccDrawPoly( const CCPoint *vertices, int numOfVertices, bool closePolygon , bool fill);
|
||||
|
||||
/** draws a circle given the center, radius and number of segments. */
|
||||
void CC_DLL ccDrawCircle( CCPoint center, float radius, float angle, int segments, bool drawLineToCenter);
|
||||
|
||||
|
|
Loading…
Reference in New Issue