1
Graphics / Vertical line artifacts in simple image
« on: February 10, 2018, 06:14:59 pm »
Hello all, I apologize for the noob level question... In this basic SFML code I can't figure out where the
black vertical lines are coming from. Any help would be appreciated.
(BTW using Visual Studio 2017 on Windows 10 running on a partitioned iMac.)
black vertical lines are coming from. Any help would be appreciated.
(BTW using Visual Studio 2017 on Windows 10 running on a partitioned iMac.)
int main()
{
sf::RenderWindow window(sf::VideoMode(520, 480), "Vertical lines issue??");
while (window.isOpen())
{
sf::Event event;
window.clear();
drawBasicFlat(window);
window.display();
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
window.close();
}
}
}
return 0;
}
//-------------------------------------------------------------
void drawBasicFlat(sf::RenderWindow& theWindow)
{
unsigned max_x = theWindow.getSize().x;
unsigned max_y = theWindow.getSize().y;
unsigned vertexCount;
for (unsigned x = 0; x < max_x; ++x)
{
sf::VertexArray line(sf::Points, max_y);
for (unsigned y = 0; y < max_y; ++y)
{
line[y].position = sf::Vector2f(x + 1, y + 1);
line[y].color = sf::Color(150, 100, 75);
}
theWindow.draw(line);
}
}
{
sf::RenderWindow window(sf::VideoMode(520, 480), "Vertical lines issue??");
while (window.isOpen())
{
sf::Event event;
window.clear();
drawBasicFlat(window);
window.display();
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
window.close();
}
}
}
return 0;
}
//-------------------------------------------------------------
void drawBasicFlat(sf::RenderWindow& theWindow)
{
unsigned max_x = theWindow.getSize().x;
unsigned max_y = theWindow.getSize().y;
unsigned vertexCount;
for (unsigned x = 0; x < max_x; ++x)
{
sf::VertexArray line(sf::Points, max_y);
for (unsigned y = 0; y < max_y; ++y)
{
line[y].position = sf::Vector2f(x + 1, y + 1);
line[y].color = sf::Color(150, 100, 75);
}
theWindow.draw(line);
}
}