From GL_LINE_STRIP to VBO/VAOs ?

Hi everyone,
I’m trying to upgrade some legacy OpenGL 1.0 code, but I don’t understand how to use efficiently VertexArrayObjects and VertexBufferObjects. Drawing one line strip is OK, but how to draw many lines at once ?
Formerly:

	glNewList(MYLIST, GL_COMPILE);
	{
                // 30 to 50 linestrips of different lengths
		glBegin(GL_LINE_STRIP);
		{
                           ...
		}
		glEnd();
                ....
		glBegin(GL_LINE_STRIP);
		{
                           ...
		}
		glEnd();
	}
	glEndList();

Should it be something like an array of VBOs, and one VAO to rule them all and on the GPU bind them ?


	vao.bind();
	for(int i=0; i<vbo.size(); i++)
	{
		vbo[i].create();
		vbo[i].bind();
		vbo[i].allocate(vertices, sizeof(vertices));
		vbo[i].release();
	}
	vao.release();

BTW, I’m using the Qt5 framework.

Any insight will be greatly appreciated.

There’s no need to use multiple VBOs. A draw call doesn’t have to use the entire VBO; you can draw any contiguous sub-range by specifying the appropriate values for the first and count parameters to glDrawArrays().

If you don’t need to change any state between strips, you can draw all of the strips with a single call to glMultiDrawArrays().

Great, thanks.