PDA

View Full Version : Occasional spikes in time taken to call glBufferSubData



Xardov
06-08-2014, 07:10 AM
generateElements();

//apparently this takes 8ms

glBufferSubData(GL_ARRAY_BUFFER, 0, vertexBuffer.size() * sizeof(vertexBuffer[0]), vertexBuffer.data());
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, elementBuffer.size() * sizeof(elementBuffer[0]), elementBuffer.data());

glDrawElements(GL_TRIANGLES, vertexCount / 4 * 6, GL_UNSIGNED_INT, 0);

vertexBuffer.clear();
elementBuffer.clear();
vertexCount = 0;


The function above normally takes < 2 ms to execute. However, it will jump to 8-30 ms about once every 2 seconds. I do not believe I have any poorly written code in the function, yet I cannot figure out why it is spiking. OpenGL 3.3 on Windows 8, Visual Studio 2013.