Valgrind Invalid write of size 8 with QGLBuffer map
I am using Qt + OpenGL + GLSL to draw a lot points in a 3D scene and I need to change the color of some points.
To initialize the color VBO I did that:
@cores = new QVector3D[num_vertices];
for(int i = 0; i < num_vertices; i++)
cores[i] = QVector3D(1.0, 1.0, 1.0);
m_vboCores = new QGLBuffer(QGLBuffer::VertexBuffer);
In the application I change the value of some elements in cores vector, and in the paintGL function I am doing that:
QVector3D vCores = (QVector3D) m_vboCores->map(QGLBuffer::WriteOnly);
for(i = 0; i < num_vertices; i++)
vCores[i] = cores[i];
m_shaderProgram->setAttributeBuffer("Cor_Vertice", GL_FLOAT, 0, 3, 0);@
And Valgrind says that are invalid write in this line:
@vCores[i] = cores[i];@
But I have used printf to check the value of i, and the index i is not out of bound... What can I doing wrong?
Or how can I check the size of memory "returned" by
I tested this code in other machines and in some of them it worked well, so the problem looks be in some combination of hardware + kernel + video driver + system libraries.