coreldraw draw a line code example

Example: glfw draw line

glColor3f(1.0,0.0,0.0); // red x
        glBegin(GL_LINES);
        // x aix
     
        glVertex3f(-4.0, 0.0f, 0.0f);
        glVertex3f(4.0, 0.0f, 0.0f);
     
        glVertex3f(4.0, 0.0f, 0.0f);
        glVertex3f(3.0, 1.0f, 0.0f);
     
        glVertex3f(4.0, 0.0f, 0.0f);
        glVertex3f(3.0, -1.0f, 0.0f);
        glEnd();
     
        // y 
        glColor3f(0.0,1.0,0.0); // green y
        glBegin(GL_LINES);
        glVertex3f(0.0, -4.0f, 0.0f);
        glVertex3f(0.0, 4.0f, 0.0f);
     
        glVertex3f(0.0, 4.0f, 0.0f);
        glVertex3f(1.0, 3.0f, 0.0f);
     
        glVertex3f(0.0, 4.0f, 0.0f);
        glVertex3f(-1.0, 3.0f, 0.0f);
        glEnd();
     
        // z 
        glColor3f(0.0,0.0,1.0); // blue z
        glBegin(GL_LINES);
        glVertex3f(0.0, 0.0f ,-4.0f );
        glVertex3f(0.0, 0.0f ,4.0f );
     
     
        glVertex3f(0.0, 0.0f ,4.0f );
        glVertex3f(0.0, 1.0f ,3.0f );
     
        glVertex3f(0.0, 0.0f ,4.0f );
        glVertex3f(0.0, -1.0f ,3.0f );
        glEnd();

Tags:

Cpp Example