diff options
author | sfan5 <sfan5@live.de> | 2021-03-11 23:48:05 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-03-12 16:30:44 +0100 |
commit | 0335a52479b6bd654482ca9d559433aa95b0e00a (patch) | |
tree | d2ce0bda3b4870de35f96d736051b490fcaedb4c /source/Irrlicht/COpenGLDriver.cpp | |
parent | 4931b346253c64069d45947960405c8f6afc0b55 (diff) | |
download | irrlicht-0335a52479b6bd654482ca9d559433aa95b0e00a.tar.xz |
Fix pixel-perfect draw2DLine on OpenGL
Diffstat (limited to 'source/Irrlicht/COpenGLDriver.cpp')
-rw-r--r-- | source/Irrlicht/COpenGLDriver.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp index 22d4abf..cbbc61a 100644 --- a/source/Irrlicht/COpenGLDriver.cpp +++ b/source/Irrlicht/COpenGLDriver.cpp @@ -1887,8 +1887,6 @@ void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position, void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end, SColor color)
{
- // TODO: It's not pixel-exact. Reason is the way OpenGL handles line-drawing (search the web for "diamond exit rule").
-
if (start==end)
drawPixel(start.X, start.Y, color);
else
@@ -1923,6 +1921,9 @@ void COpenGLDriver::draw2DLine(const core::position2d<s32>& start, }
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, Quad2DIndices);
+
+ // Draw non-drawn last pixel (search for "diamond exit rule")
+ glDrawArrays(GL_POINTS, 1, 1);
}
}
|