generateElements();

//apparently this takes 8ms

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