
Dengan menggunakan format Cpp. #include<windows.h>#include<stdio.h>#include<stdlib.h>#include<string.h>#include<stdarg.h>#include<glut.h>void kerucut(){glClear(GL_COLOR_BUFFER_BIT);//1glBegin(GL_LINE_LOOP);glVertex2f(-0.4,-0.6);glVertex2f(-0.4,0.2);glVertex2f(-0.1,0);glVertex2f(-0.1,-0.8);glEnd();glFlush();//2glBegin(GL_LINE_LOOP);glVertex2f(-0.4,-0.6);glVertex2f(-0.4,0.2);glVertex2f(-0.2,0.4);glVertex2f(-0.2,-0.4);glEnd();glFlush();//3glBegin(GL_LINE_LOOP);glVertex2f(-0.2,-0.4);glVertex2f(-0.2,0.4);glVertex2f(0,0.4);glVertex2f(0,-0.4);glEnd();glFlush();//4glBegin(GL_LINE_LOOP);glVertex2f(0,-0.4);glVertex2f(0,0.4);glVertex2f(0.2,0.2);glVertex2f(0.2,-0.6);glEnd();glFlush();//5glBegin(GL_LINE_LOOP);glVertex2f(-0.1,-0.8);glVertex2f(-0.1,0);glVertex2f(0.2,0.2);glVertex2f(0.2,-0.6);glEnd();glFlush();//segitiga//1glBegin(GL_LINE_LOOP);glVertex2f(-0.4,0.2);glVertex2f(-0.1,0.9);glVertex2f(-0.1,0);glEnd();glFlush();//2glBegin(GL_LINE_LOOP);glVertex2f(-0.2,0.4);glVertex2f(-0.1,0.9);glVertex2f(-0.4,0.2);glEnd();glFlush();//3glBegin(GL_LINE_LOOP);glVertex2f(-0.2,0.4);glVertex2f(-0.1,0.9);glVertex2f(0,0.4);glEnd();glFlush();//4glBegin(GL_LINE_LOOP);glVertex2f(0,0.4);glVertex2f(-0.1,0.9);glVertex2f(0.2,0.2);glEnd();glFlush();//5glBegin(GL_LINE_LOOP);glVertex2f(-0.1,0);glVertex2f(-0.1,0.9);glVertex2f(0.2,0.2);glEnd();glFlush();}int main(int argc, char**argv){glutCreateWindow("");glutDisplayFunc(kerucut);glutMainLoop();} Hasil compile ...
Read more