Hello everyone,
I'm currently tryring to implement a tile map editor using sfml and Qt, and I am meeting some kind of a problem/bug when drawing vertical and horizontal lines. I can easily work around it, but it just does not feel right to me
.
Here is a code snippet that reproduces my problem :
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");
sf::Vertex hLine[] =
{
sf::Vertex(sf::Vector2f(0, 0)),
sf::Vertex(sf::Vector2f(150, 0))
};
sf::Vertex vLine[] =
{
sf::Vertex(sf::Vector2f(0, 0)),
sf::Vertex(sf::Vector2f(0, 150))
};
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(hLine, 2, sf::Lines);
window.draw(vLine, 2, sf::Lines);
window.display();
}
My question is : how is it that I can see the horizontal line but not the vertical one ?
If I add an offset of 0.01 for the x dimension of the vertical line, I can see it. But why ?
Now, if I try to move the lines at the extreme opposite of the window (hLine at y = 600 and vLine at x = 800), I can now see the vertical line but not the horizontal line. It makes sense regarding the initial issue, but then again it does not feel right, the two dimensions should work the same way...
Here are some related topics, they talk about a "0.375 offset issue", but it was supposed to be solved a long long time ago.
http://en.sfml-dev.org/forums/index.php?topic=15747.0http://en.sfml-dev.org/forums/index.php?topic=14504https://github.com/SFML/SFML/issues/252Thank you in advance for your answers