MASIGNASUKAv102
4922683097822459718

Cara membuat rumah dengan opengl

Cara membuat rumah dengan opengl
Add Comments
7/07/2019
Cara membuat rumah dengan opengl
4/ 5
Oleh
Nesiasite - Tutorial & Berita Teknologi - Hallo teman-teman semua, Apa kabar kalian hari ini ? Kali ini saya akan berbagi sedikit tentang codingan Cara membuat rumah dengan opengl. Seperti biasa codingan ini saya bagikan secara gratis. ya teman-teman hanya cukup brikan komentar dibawah sebagai tanda terimakasi. Oke teman-teman-teman langsung saja tanpa basa basi silahkan di sedot saja codiangan do bawah ini.




#include 
#include
#include


void init(void) {
glClearColor(0.0, 0.9, 0.5, 5.0);
//glColor3f(1.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 1000.0, 0.0, 1000.0);
// glOrtho(-100.0, 100.0, -100.0, 100.0, -100.0, 100.0);
}


void tampilan(void) {


glClear(GL_COLOR_BUFFER_BIT);
glLineWidth(1);

//atap rumah
glColor3f(0.0, 0.0, 1.0);
glBegin(GL_POLYGON);

glVertex2i(320, 540);
glVertex2i(560, 660);

glVertex2i(560, 660);
glVertex2i(800, 540);

glVertex2i(800, 540);
glVertex2i(320, 540);
glEnd();

//Luar Rumah
glBegin(GL_LINES);
//glColor3f(1.0, 0.0, 0.0);
glVertex2i(360, 540);
glVertex2i(360, 520);

glVertex2i(360, 520);
glVertex2i(80, 380);

glVertex2i(80, 380);
glVertex2i(380, 380);

glVertex2i(380, 380);
glVertex2i(380, 376);

glVertex2i(380, 376);
glVertex2i(80, 376);

glVertex2i(80, 376);
glVertex2i(120, 376);

glVertex2i(120, 376);
glVertex2i(120, 196);

glVertex2i(120, 196);
glVertex2i(760, 196);

glVertex2i(760, 196);
glVertex2i(760, 540);

glVertex2i(760, 540);
glVertex2i(360, 540);
glEnd();
//Dalam Rumah (Jendela)
//jendela 1
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(420, 420);
glVertex2i(420, 520);

glVertex2i(420, 520);
glVertex2i(500, 520);

glVertex2i(500, 520);
glVertex2i(500, 420);

glVertex2i(500, 420);
glVertex2i(420, 420);
glEnd();
//jendela 2
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(620, 420);
glVertex2i(620, 520);

glVertex2i(620, 520);
glVertex2i(700, 520);

glVertex2i(700, 520);
glVertex2i(700, 420);

glVertex2i(700, 420);
glVertex2i(620, 420);
glEnd();

//jendela 3
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(420, 280);
glVertex2i(420, 380);

glVertex2i(420, 380);
glVertex2i(500, 380);

glVertex2i(500, 380);
glVertex2i(500, 280);

glVertex2i(500, 280);
glVertex2i(420, 280);
glEnd;

//jendela 4
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(620, 260);
glVertex2i(620, 380);

glVertex2i(620, 380);
glVertex2i(720, 380);

glVertex2i(720, 380);
glVertex2i(720, 260);

glVertex2i(720, 260);
glVertex2i(620, 260);
glEnd;
//pintu
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(520, 252);
glVertex2i(520, 386);

glVertex2i(520, 386);
glVertex2i(500, 386);

glVertex2i(500, 386);
glVertex2i(500, 400);

glVertex2i(500, 400);
glVertex2i(540, 420);

glVertex2i(540, 420);
glVertex2i(580, 420);

glVertex2i(580, 420);
glVertex2i(620, 400);

glVertex2i(620, 400);
glVertex2i(620, 386);

glVertex2i(620, 386);
glVertex2i(600, 386);

glVertex2i(600, 386);
glVertex2i(600, 252);

glVertex2i(600, 252);
glVertex2i(520, 252);
glEnd;

//sisi pintu
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(500, 400);
glVertex2i(620, 400);

glVertex2i(520, 386);
glVertex2i(620, 386);
glEnd;
//sisi dalam rumah
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(360, 520);
glVertex2i(360, 400);

glVertex2i(360, 400);
glVertex2i(380, 380);
glEnd;

//pintu samping kiri
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(160, 208);
glVertex2i(160, 320);

glVertex2i(160, 320);
glVertex2i(200, 320);

glVertex2i(200, 320);
glVertex2i(200, 208);

glVertex2i(200, 208);
glVertex2i(160, 208);
glEnd;
//sisi rumah
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(160, 220);
glVertex2i(120, 220);
glEnd;
//sisi rumah
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(360, 220);
glVertex2i(200, 220);
glEnd;
//sisi rumah
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(360, 220);
glVertex2i(360, 240);
glEnd;

//sisi rumah
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(360, 240);
glVertex2i(760, 240);
glEnd;
//sisi pintu
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(548, 356);
glVertex2i(548, 364);

glVertex2i(548, 364);
glVertex2i(568, 356);

glVertex2i(568, 356);
glVertex2i(568, 364);

glVertex2i(568, 364);
glVertex2i(548, 356);
glEnd;
//sisi jendela 1
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(460, 420);
glVertex2i(460, 520);

glVertex2i(500, 468);
glVertex2i(420, 468);

glEnd();

//sisi jendela 2
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);

glVertex2i(660, 420);
glVertex2i(660, 520);

glVertex2i(620, 468);
glVertex2i(700, 468);

glEnd();

//sisi jendela 3
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);

glVertex2i(460, 280);
glVertex2i(460, 380);

glVertex2i(420, 330);
glVertex2i(500, 330);

glEnd();

//sisi jendela 4
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);

glVertex2i(670, 260);
glVertex2i(670, 380);

glVertex2i(620, 300);
glVertex2i(720, 300);

glVertex2i(620, 340);
glVertex2i(720, 340);

//Bawah Rumah
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 1.0);

glVertex2i(844, 190);
glVertex2i(120, 190);

glVertex2i(844, 200);
glVertex2i(844, 204);

glVertex2i(200, 844);
glVertex2i(204, 844);





//garis Bawah atap Rumah
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 1.0);

glVertex2i(320, 534);
glVertex2i(800, 534);

//atatp teras samping kanan
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 1.0);

glVertex2i(760, 380);
glVertex2i(760, 440);

glVertex2i(760, 440);
glVertex2i(860, 380);

glVertex2i(860, 380);
glVertex2i(760, 380);

glVertex2i(760, 374);
glVertex2i(860, 374);

glEnd();

//teras samping
glBegin(GL_LINES);
glColor3f(0.0, 0.0, 1.0);

glVertex2i(760, 380);
glVertex2i(760, 440);

glVertex2i(760, 440);
glVertex2i(860, 380);

glVertex2i(860, 380);
glVertex2i(760, 380);

glVertex2i(760, 374);
glVertex2i(860, 374);

glVertex2i(840, 240);
glVertex2i(840, 374);

glVertex2i(844, 240);
glVertex2i(844, 200);

glVertex2i(760, 200);
glVertex2i(844, 200);

glVertex2i(760, 240);
glVertex2i(844, 240);

glVertex2i(844, 240);
glVertex2i(844, 200);

glVertex2i(836, 240);
glVertex2i(836, 374);




glEnd();


//pintu samping kiri
glBegin(GL_LINES);
glColor3f(1.0, 1.0, 0.0);

glVertex2i(188, 248);
glVertex2i(190, 250);

glEnd();

glFlush();
glutSwapBuffers();

}

int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowSize(1000, 820);

glutInitWindowPosition(0, 0);
glutCreateWindow("RUMAH");
init();
glutDisplayFunc(tampilan);
glutMainLoop();
return 0;
}
OmJuan.com

Adalah Situs berbagi Source Code gratis dan Pembahasan seputar HTML, CSS, JavaScript, PHP, Bootstrap.

Terimakasih telah mengunjungi situs ini. Silahkan berkomentar dengan bijak.Komentar spam atau berisikan link aktif tidak akan di tampilkan. Terimakasih