Hi everyone! I need your help
Im trying to draw multiples lines with glBegin(GL_LINE_STRIP); right?
For this, i have 2 class
1.
2.Code :Class1::Class1(float x, float y, float z) { xS = x; /* xS is a float */ yS = y; /* yS is a float * zS = z; /* zS is a float * }
Two class have getter and setter methods.Code :Class2::Class2(float x1, float y1, float z1) { xT = x1; /* xT is a float */ yT = y1; /* yT is a float * zT = z1; /* zT is a float * }
And i have 2 QVector
and i have 2 iterator, obviously:Code :1. QVector<Class1*> clas1Vector; /* any object in the vector contain 3 values: x, y, z*/ 1. QVector<Class2*> clas2Vector; /* any object in the vector contain 3 values: x1, y1, z1*/
okay, now its my question: How can i draw lines with glBegin(GL_LINE_STRIP); without deleting or replacing the previous line? That is, when drawing a new line, the previous one do not erase.Code :1. QVector<Class1*>::iterator is; for (is = clas1Vector.begin(); is != clas1Vector.end(); ++is) { x = (*is)->getXS(); y = (*is)->getYS(); z = (*is)->getZS(); } 2. QVector<Class2*>::iterator it; for (it = clas2Vector.begin(); it != clas2Vector.end(); ++it) { x2 = (*it)->getXT(); y2 = (*it)->getYT(); z2 = (*it)->getZT(); }
Actually draw the lines so:
Code :glBegin(GL_LINE_STRIP); glColor3f(0.0f, 1.0f, 0.0f); // Green glVertex3f( x, y, z); glVertex3f( x2, y2, z2); glEnd();