bugfix: OPENGL_GAL::drawPolygon did not respect fill settings

The OPENGL_GAL::drawPolygon function and all functions using it
did not respect the isFillEnabled member set by
GAL::SetIsFill. This is fixed by this patch.
This commit is contained in:
Andreas Buhr 2017-12-08 12:44:46 +01:00 committed by Maciej Suminski
parent 084eea6781
commit 5572183c22
1 changed files with 25 additions and 20 deletions

View File

@ -1511,32 +1511,37 @@ void OPENGL_GAL::drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRa
void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
{
currentManager->Shader( SHADER_NONE );
currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a );
// Any non convex polygon needs to be tesselated
// for this purpose the GLU standard functions are used
TessParams params = { currentManager, tessIntersects };
gluTessBeginPolygon( tesselator, &params );
gluTessBeginContour( tesselator );
GLdouble* point = aPoints;
for( int i = 0; i < aPointCount; ++i )
if( isFillEnabled )
{
gluTessVertex( tesselator, point, point );
point += 3; // 3 coordinates
currentManager->Shader( SHADER_NONE );
currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a );
// Any non convex polygon needs to be tesselated
// for this purpose the GLU standard functions are used
TessParams params = { currentManager, tessIntersects };
gluTessBeginPolygon( tesselator, &params );
gluTessBeginContour( tesselator );
GLdouble* point = aPoints;
for( int i = 0; i < aPointCount; ++i )
{
gluTessVertex( tesselator, point, point );
point += 3; // 3 coordinates
}
gluTessEndContour( tesselator );
gluTessEndPolygon( tesselator );
// Free allocated intersecting points
tessIntersects.clear();
}
gluTessEndContour( tesselator );
gluTessEndPolygon( tesselator );
// Free allocated intersecting points
tessIntersects.clear();
if( isStrokeEnabled )
{
drawPolyline( [&](int idx) { return VECTOR2D( aPoints[idx * 3], aPoints[idx * 3 + 1] ); },
aPointCount );
}
}