summaryrefslogtreecommitdiff
path: root/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2022-12-10 13:10:36 +0100
committerGitHub <noreply@github.com>2022-12-10 13:10:36 +0100
commit5673072271cdd797de3fa0f3136ca3f1d219484e (patch)
tree1d44908a58bc3c0d3fa5a324b0f829a464bcf6d3 /src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
parentdf059de37e776874cf1fbe303141764f1c8fc34e (diff)
Fixes OpenGL complex polygons when scaling (#576)
Also fixes gap()
Diffstat (limited to 'src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx')
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
index 1229b1d4b..bf29ff8df 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
+++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
@@ -138,10 +138,12 @@ void Fl_OpenGL_Graphics_Driver::end_complex_polygon()
// find the bounding box for this polygon
v0 = xpoint;
+ v0->y -= 0.1f;
float xMin = v0->x, xMax = xMin;
int yMin = (int)v0->y, yMax = yMin;
for (i = 1; i < n; i++) {
v0++;
+ v0->y -= 0.1f;
float v0x = v0->x;
int v0y = (int)v0->y;
if (v0x == GAP) continue;
@@ -157,14 +159,14 @@ void Fl_OpenGL_Graphics_Driver::end_complex_polygon()
return;
// loop through the rows of the image
- for (y = yMin; y < yMax; y++) {
+ for (y = yMin; y <= yMax; y++) {
// Build a list of all crossing points with this y axis
v0 = xpoint + 0;
v1 = xpoint + 1;
nNodes = 0;
for (i = 1; i < n; i++) {
if (v1->x==GAP) { // skip the gap
- i++; v0++; v1++;
+ i++; v0++; v1++; v0++; v1++;
continue;
}
if ( (v1->y < y && v0->y >= y)
@@ -194,7 +196,7 @@ void Fl_OpenGL_Graphics_Driver::end_complex_polygon()
}
// fill the pixels between node pairs
- glBegin(GL_LINES);
+// glBegin(GL_LINES);
for (i = 0; i < nNodes; i += 2) {
float x0 = nodeX[i];
if (x0 >= xMax)
@@ -205,11 +207,12 @@ void Fl_OpenGL_Graphics_Driver::end_complex_polygon()
x0 = xMin;
if (x1 > xMax)
x1 = xMax;
- glVertex2f((GLfloat)x0, (GLfloat)y);
- glVertex2f((GLfloat)x1, (GLfloat)y);
+ glRectf(x0-0.25f, y, x1+0.25f, y+1.0f);
+// glVertex2f((GLfloat)x0, (GLfloat)y);
+// glVertex2f((GLfloat)x1, (GLfloat)y);
}
}
- glEnd();
+// glEnd();
}
::free(nodeX);