Membuat BENTUK Kerucut 3D VS 2008
10.02
By
Unknown
VS
0
komentar
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);
//1
glBegin(GL_LINE_LOOP);
glVertex2f(-0.4,-0.6);
glVertex2f(-0.4,0.2);
glVertex2f(-0.1,0);
glVertex2f(-0.1,-0.8);
glEnd();
glFlush();
//2
glBegin(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();
//3
glBegin(GL_LINE_LOOP);
glVertex2f(-0.2,-0.4);
glVertex2f(-0.2,0.4);
glVertex2f(0,0.4);
glVertex2f(0,-0.4);
glEnd();
glFlush();
//4
glBegin(GL_LINE_LOOP);
glVertex2f(0,-0.4);
glVertex2f(0,0.4);
glVertex2f(0.2,0.2);
glVertex2f(0.2,-0.6);
glEnd();
glFlush();
//5
glBegin(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
//1
glBegin(GL_LINE_LOOP);
glVertex2f(-0.4,0.2);
glVertex2f(-0.1,0.9);
glVertex2f(-0.1,0);
glEnd();
glFlush();
//2
glBegin(GL_LINE_LOOP);
glVertex2f(-0.2,0.4);
glVertex2f(-0.1,0.9);
glVertex2f(-0.4,0.2);
glEnd();
glFlush();
//3
glBegin(GL_LINE_LOOP);
glVertex2f(-0.2,0.4);
glVertex2f(-0.1,0.9);
glVertex2f(0,0.4);
glEnd();
glFlush();
//4
glBegin(GL_LINE_LOOP);
glVertex2f(0,0.4);
glVertex2f(-0.1,0.9);
glVertex2f(0.2,0.2);
glEnd();
glFlush();
//5
glBegin(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
#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);
//1
glBegin(GL_LINE_LOOP);
glVertex2f(-0.4,-0.6);
glVertex2f(-0.4,0.2);
glVertex2f(-0.1,0);
glVertex2f(-0.1,-0.8);
glEnd();
glFlush();
//2
glBegin(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();
//3
glBegin(GL_LINE_LOOP);
glVertex2f(-0.2,-0.4);
glVertex2f(-0.2,0.4);
glVertex2f(0,0.4);
glVertex2f(0,-0.4);
glEnd();
glFlush();
//4
glBegin(GL_LINE_LOOP);
glVertex2f(0,-0.4);
glVertex2f(0,0.4);
glVertex2f(0.2,0.2);
glVertex2f(0.2,-0.6);
glEnd();
glFlush();
//5
glBegin(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
//1
glBegin(GL_LINE_LOOP);
glVertex2f(-0.4,0.2);
glVertex2f(-0.1,0.9);
glVertex2f(-0.1,0);
glEnd();
glFlush();
//2
glBegin(GL_LINE_LOOP);
glVertex2f(-0.2,0.4);
glVertex2f(-0.1,0.9);
glVertex2f(-0.4,0.2);
glEnd();
glFlush();
//3
glBegin(GL_LINE_LOOP);
glVertex2f(-0.2,0.4);
glVertex2f(-0.1,0.9);
glVertex2f(0,0.4);
glEnd();
glFlush();
//4
glBegin(GL_LINE_LOOP);
glVertex2f(0,0.4);
glVertex2f(-0.1,0.9);
glVertex2f(0.2,0.2);
glEnd();
glFlush();
//5
glBegin(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
0 komentar: