Hi,
I'm developing an audio application, and I am currently working on a waveform viewer.
My code currently draws 1x1 pixel points using the values stored in the multibuffer, and I would like to know how to draw lines between each of these points. This code from a tutorial on the website looked useful, but I wasn't sure how to dynamically set the points like I can do with my code below. Code from tutorial:
sf::Vertex vertices[2] =
{
sf::Vertex(...),
sf::Vertex(...)
};
window.draw(vertices, 2, sf::Lines);
I am aware my code is far from optimised at the moment. Any help would be great.
Thanks,
Mark
My current code:
window.setActive(true);
while (window.isOpen())
{
clock.restart();
sf::Event event;
while (window.pollEvent(event))
{
switch(event.type)
{
case sf::Event::Closed:
window.close();
break;
}
}
sf::VertexArray vertexPoints(sf::Points, windowX);
for (int i = 0; i < 600; i++)
{
vertexPoints[i].position = sf::Vector2f(i, (windowY/2)+multibuffer[0][i]*400);
}
window.setView(view);
window.clear();
window.draw(vertexPoints);
window.display();
}
}