diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx | 12 | ||||
| -rw-r--r-- | src/gl_draw.cxx | 10 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx index 22956605c..044b16450 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx +++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx @@ -31,9 +31,15 @@ // --- line and polygon drawing with integer coordinates void Fl_OpenGL_Graphics_Driver::point(int x, int y) { - glBegin(GL_POINTS); - glVertex2f(x+0.5f, y+0.5f); - glEnd(); + if (line_width_ == 1.0f) { + glBegin(GL_POINTS); + glVertex2f(x+0.5f, y+0.5f); + glEnd(); + } else { + float offset = line_width_ / 2.0f; + float xx = x+0.5f, yy = y+0.5f; + glRectf(xx-offset, yy-offset, xx+offset, yy+offset); + } } void Fl_OpenGL_Graphics_Driver::rect(int x, int y, int w, int h) { diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index 35b2007f8..e6adaa1c7 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -216,12 +216,12 @@ void gl_measure(const char* str, int& x, int& y) { void gl_rect(int x, int y, int w, int h) { if (w < 0) {w = -w; x = x-w;} if (h < 0) {h = -h; y = y-h;} - glBegin(GL_LINE_STRIP); - glVertex2i(x+w-1, y+h-1); - glVertex2i(x+w-1, y); + glBegin(GL_LINE_LOOP); + int r = x+w-1, b = y+h-1; + glVertex2i(r, b); + glVertex2i(r, y); glVertex2i(x, y); - glVertex2i(x, y+h-1); - glVertex2i(x+w, y+h-1); + glVertex2i(x, b); glEnd(); } |
