Ok, I take my courage to understand the new method, and it was finally not the hard.
I replaced :
m_myVbo.bind();
m_myVbo.write(0, m_vertexData.constData(), m_floatCount * static_cast<int>(sizeof(GLfloat)));
glDrawArrays(GL_TRIANGLES, 0, m_vertexCount);
m_myVbo.release();
m_myVbo.bind();
m_myVbo.write(0, m_vertexData.constData(), m_floatCount * static_cast<int>(sizeof(GLfloat)));
glDrawArrays(GL_TRIANGLES, 0, m_vertexCount);
m_myVbo.release();
To copy to clipboard, switch view to plain text mode
by :
m_myVbo.bind();
auto ptr = m_myVbo.mapRange(0, m_vertexData.size()*int(sizeof(GLfloat)),
QOpenGLBuffer::RangeInvalidateBuffer | QOpenGLBuffer::RangeWrite);
memcpy(ptr, m_vertexData.data(), size_t(m_vertexData.size())*sizeof(GLfloat));
m_myVbo.unmap();
glDrawArrays(GL_TRIANGLES, 0, m_vertexCount);
m_myVbo.release();
m_myVbo.bind();
auto ptr = m_myVbo.mapRange(0, m_vertexData.size()*int(sizeof(GLfloat)),
QOpenGLBuffer::RangeInvalidateBuffer | QOpenGLBuffer::RangeWrite);
memcpy(ptr, m_vertexData.data(), size_t(m_vertexData.size())*sizeof(GLfloat));
m_myVbo.unmap();
glDrawArrays(GL_TRIANGLES, 0, m_vertexCount);
m_myVbo.release();
To copy to clipboard, switch view to plain text mode
But the performances were quite the same ; can't see the difference on GPU monitoring (load of around 90% for 50 000 lines).
Bookmarks