Drawing lines with a vector of verticies

I’m currently trying to draw a line from data contained in an array. This is what I have working



glBegin(GL_LINE_STRIP);

for (int i=0; i<bufferLen; i++)
	glVertex2f(i, buffer[i]);

glEnd();

Is there a more efficient way to do this, or do I have to pass each vertex individualy?

use vertex buffer objects http://www.opengl.org/wiki/Vertex_Buffer_Object

If you want improved efficiency, you should consider not using immediate mode, which is deprecated. See tutorial at http://www.arcsynthesis.org/gltut/