I’m working on a simple opengl application where I plot a bunch of data represented as a line. For performance reasons, I split up the data into multiple chunks and upload them into several VOBs. Later, I render each VBO individually. The following is some example code:
n_COORDINATES_PER_VERTEX = 2
NBR_DATA_POINTS_PER_VBO = 1000
# plot each VBO
for segment in range(segments):
# bind the named buffer object so we can work with it.
glBindBuffer(GL_ARRAY_BUFFER, vbos[segment])
# specifies the location and data format of an array of vertex coordinates to use when rendering
glVertexPointer(n_COORDINATES_PER_VERTEX, GL_FLOAT, 0, 0)
# render primitives from array data
glDrawArrays(GL_LINE_STRIP, 0, NBR_DATA_POINTS_PER_VBO)
This works really well, but unfortunately the there’s a visual gap between the last point of the previous VBO and the first point of the next VBO. This makes sense, since the GL_LINE_STRIP is only created for the data inside each VBO.
Therefore my question: How can I achieve that the multiple VBOs are rendered as one single line, without jumps inbetween?
You can do this by
To make an unbroken polyline, you need to share common points across VBOS (I see no other option), you may choose any method you wish.
Something like that – it looks like you can’t render all the points in one go – so I’ll skip my solution that involved glDrawElements which you can use to draw an indexed mesh.