How can draw line to different points?

Hi everyone :smiley:

I’m drawing points and joining them with a line, but i have a question…

For example, i have 2 points called Gateways and other points called Transmitter and i need to join, 5 Transmitter (GL_POINTS) with 1 Gateway (GL_POINTS), when they are 5, go to the next Gateway and join 5 more Transmitter, but i can’t :(.

Example Gif.

Follow the gif, i need the last 3 points to connect to the next purple point.

This is my code for draw a dashed line between points


void MyClass::conectionTG()
        {
            glPushAttrib(GL_ENABLE_BIT);
            glLineStipple(7, 0xAAAA);  //# [1]
            glEnable(GL_LINE_STIPPLE);
            glBegin(GL_LINES);
            glColor3f(0.0f, 0.0f, 1.0f); // blue color
            QVectorIterator<Transmitter*> it(_transmitterVector);  Transmitter it's a class, the constructor is (int i, double x, double y, double z);
            QVectorIterator<Gateway*> ig(_gatewayVector); Gateway it's a class, the constructor is (int i, double x, double y, double z);
            if(_gatewayVector.size() != 0 && _transmitterVector.size() !=0)
            {
                Gateway *g = ig.next();
                while(it.hasNext())
                {
                    Transmitter *t = it.next();
                    glVertex3d(t->getXT(), t->getYT(), t->getZT());
                    glVertex3d(g->getXG(), g->getYG(), g->getZG());
                }
            }
            glEnd();
            glDisable(GL_LINE_STIPPLE);
        }

Help me pls :C