Hello,
I am currently doing a basic program supposed to draw a plot with data received from a serial communication, sending a number every n milliseconds.
I'm using two classes:
- a Qt widget ( receives the data, and send it to the second class) (FenPrincipale.h )
- the plot class, wich draws the plot (stores X and Y numbers in 2 float vectors and then add a position to a sf::VertexArray). (FenPlot.h)
//FenPlot Constructor
int size = 10000;
m_curve = sf::VertexArray(sf::LinesStrip, size);
m_currentX = 0;
m_vectorX.resize(size);
m_vectorY.resize(size);
//addY() function
void FenPlot::addY(int y)
{
m_vectorX[m_currentX] = (float)m_currentX;
m_vectorY[m_currentX] = (float)y;
m_curve[m_currentX].position = sf::Vector2f(m_vectorX[m_currentX], m_vectorY[m_currentX]);
m_currentX++;
}
The issue I am having is that , after few values added, the program slows down and evetually freeze.
I can't figure out the reason to that progressive loss of performance.
Qt 5.4.0, SFML 2.3, Win 8.1, QtCreator Thank you