Answers for "glfw draw line"

C++
0

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();
Posted by: Guest on March-04-2021

Browse Popular Code Answers by Language