Dec 15, 2010

Gambar 3D Menggunakan Pelles C

Buat anak - anak kelas 3ia06 Universitas Gunadarma, ini listing kisi - kisi UTS GrafKom yang gambar 3D ,, silahkan dicoba :)
Ni listingnya ,, tulis di bawah kata "lakukan penggambaran di sini" .. Tinggal diatur sendiri gluLookAt sama glColor nyaa, sama coba - coba sendiri aja titik vertexnyaa ;) 

gluLookAt(5,20,10,0,0,0,0,1,0);

glBegin(GL_QUADS);
//Kubus

glColor3ub(165,241,134);
//depan
glVertex3f(0,0,0);
glVertex3f(6,0,0);
glVertex3f(6,6,0);
glVertex3f(0,6,0);

//belakang
glVertex3f(0,0,-6);
glVertex3f(6,0,-6);
glVertex3f(6,6,-6);
glVertex3f(0,6,-6);

glColor3ub(280,213,120);
//atas
glVertex3f(0,6,0);
glVertex3f(6,6,0);
glVertex3f(6,6,-6);
glVertex3f(0,6,-6);

//bawah
glVertex3f(0,0,0);
glVertex3f(6,0,0);
glVertex3f(6,0,-6);
glVertex3f(0,0,-6);

glColor3ub(114,156,100);
//kiri
glVertex3f(0,0,0);
glVertex3f(0,0,-6);
glVertex3f(0,6,-6);
glVertex3f(0,6,0);

//kanan
glVertex3f(6,0,0);
glVertex3f(6,0,-6);
glVertex3f(6,6,-6);
glVertex3f(6,6,0);
glEnd();

glBegin(GL_TRIANGLES);
//limas
glColor3ub(141,298,100);
//depan
glVertex3f(0,0,0);
glVertex3f(0,6,0);
glVertex3f(-5,3,-3);

//belakang
glVertex3f(0,6,-6);
glVertex3f(0,0,-6);
glVertex3f(-5,3,-3);

glColor3ub(111,299,114);
//atas
glVertex3f(0,6,0);
glVertex3f(0,6,-6);
glVertex3f(-5,3,-3);

//bawah
glVertex3f(0,0,0);
glVertex3f(0,0,-6);
glVertex3f(-5,3,-3);
glEnd();

OUTPUT

1 comment: