I am trying to draw a vertical line where x=0 but I can't see it. I have to use x=1 to see a line. However, for horizontal lines, I can see lines where y=0. I don't understand the difference in behavior.
sf::RenderWindow window(sf::VideoMode(640, 480), "fghjnufhg");
{
const std::array<sf::Vertex, 2> line =
{
sf::Vertex(sf::Vector2f(0, 0), sf::Color::Red),
sf::Vertex(sf::Vector2f(0, 100), sf::Color::Red)
};
window.draw(line.data(), line.size(), sf::Lines, sf::RenderStates::Default);
}
{
const std::array<sf::Vertex, 2> line =
{
sf::Vertex(sf::Vector2f(1, 0), sf::Color::Green),
sf::Vertex(sf::Vector2f(1, 100), sf::Color::Green)
};
window.draw(line.data(), line.size(), sf::Lines, sf::RenderStates::Default);
}
{
const std::array<sf::Vertex, 2> line =
{
sf::Vertex(sf::Vector2f(0, 0), sf::Color::Yellow),
sf::Vertex(sf::Vector2f(100, 0), sf::Color::Yellow)
};
window.draw(line.data(), line.size(), sf::Lines, sf::RenderStates::Default);
}
{
const std::array<sf::Vertex, 2> line =
{
sf::Vertex(sf::Vector2f(0, 1), sf::Color::Blue),
sf::Vertex(sf::Vector2f(100, 1), sf::Color::Blue)
};
window.draw(line.data(), line.size(), sf::Lines, sf::RenderStates::Default);
}
window.display();