I have a program that streams data from an external source and then plots a 3D height map of that data. Basically I am plotting 2048 X points by 100 Z points about 10 times a second. So a total of 2,000,000 vertices per second. Currently this is done as follows:
Read in 2048 points. Put this into a circular buffer of 2048x100. This buffer is then copied into a VBO linearly and then plotted using glBufferSubData. This all works fine but it seems very inefficient to have to copy the data from the circular buffer to the VBO and then transfer it to the GPU when only the first row contains new data, and all the remaining rows minus 1 are just translated in the Z direction by one row. Can this be done in another way using the VBO as a circular buffer?
Currently, frames are rendered within 16ms but CPU utilization on a core i7 laptop with a NVidia 750m processor is about 15%. If I use the Intel 4500 GPU rendering takes about 280ms(!) per frame.
I should mention that to plot this VBO I use one glDrawElements call using a triangle strip and indices ( the strip changes but not the indices).
double buffered VAO:
– use 2 VAO (vertex array) +2 VBO (vertex buffer) + 2 IBO (element buffer)
– switch each frame the VAO you want to draw from
– while drawing with VAO 1, update buffer VBO 2
– while drawing with VAO 2, update buffer VBO 1
– you can use the same IBO for both VAOs
2048 x 100 x sizeof(vec3) = 2.45MByte, thats not much memory to update i’d assume