Pyramid in openGL

Wednesday, July 9, 2014

The following code is the code that draws a pyramid on the three dimensional space, my question is how exactly openGL draws the edges of the pyramid? And in what order?


I know that in the two dimensional space we start drawing from lower left vertex and right against the direction of the clock.



// pyramid
glPushMatrix();
glTranslatef(0,-1,1);
glColor3f (1.0, 1.5,0.0);
glBegin(GL_LINE_LOOP);
glVertex3f(-1,-1,-1);
glVertex3f(-1,-1,1);
glVertex3f(1,-1,1);
glVertex3f(1,-1,-1);
glVertex3f(-1,-1,-1);
glVertex3f(0,0,0.5);
glVertex3f(-1,-1,1);
glVertex3f(1,-1,1);
glVertex3f(0,0,0.5);
glVertex3f(1,-1,-1);
glEnd();
glPopMatrix(); //end pyramid






http://ift.tt/1ojnLw2