GL_ARRAY_BUFFER related issue, delete CPU buffer after glBufferData

glGenBuffers(1, &m_vertex);
glBindBuffer(GL_ARRAY_BUFFER, m_vertex);
glBufferData(GL_ARRAY_BUFFER, m_vertexPoints.size()*sizeof(MyVertex), &m_vertexPoints[0], GL_DYNAMIC_DRAW);

m_vertexPoints.clear(); //the culprit?
this code does not render anything

I don’t understand, I should be allowed to delete the buffer once it is copied
Tested on Intel(R) Pentium(R) Silver J5040 CPU @ 2.00GHz (IGP), Linux Mint 20.1

but then calling after the first call to glDrawArrays (via call list ‘only’), then this works fine.

You can delete or otherwise invalidate the CPU-side data as soon as glBufferData returns.

Whatever your problem is, it isn’t with the code shown above.

right…I have fond the error in my code. This works as per documentation. Thanks

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.