PDA

View Full Version : Drawing lines with a vector of verticies



slayton
07-13-2011, 03:30 PM
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?

mobeen
07-13-2011, 08:10 PM
use vertex buffer objects http://www.opengl.org/wiki/Vertex_Buffer_Object

Kopelrativ
07-14-2011, 05:57 AM
If you want improved efficiency, you should consider not using immediate mode, which is deprecated. See tutorial at http://www.arcsynthesis.org/gltut/