mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 06:20:21 +02:00
Fix pixel-perfect draw2DLine on OpenGL
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user