JUST SHARE, LEARN, TOGETHER, LET'S RAWKER

Selasa, 24 Mei 2016

Membuat Bangunan Rumah Dengan OpenGL

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <glut.h>

void Bangunan(){
     glClear(GL_COLOR_BUFFER_BIT);
    //glTranslated(0.3, 0.5,0 );
    glColor3f(1,0,1); //tengah

    glBegin(GL_POLYGON);
    glVertex2f(-0.7, -0.5);
    glVertex2f(-0.7, 0.3);
    glVertex2f(0.1, 0.3);
    glVertex2f(0.1, -0.5);
    glEnd();
    glFlush();

    glColor3f(1,0,0);//ATAP
    glBegin(GL_POLYGON);
    glVertex2f(-0.3,0.7);
    glVertex2f(-0.75,0.3);
    glVertex2f(0.15,0.3);
    glEnd();
    glFlush();

    glColor3f(1,1,0);
//glBegin(GL_LINE_LOOP);
    glTranslated(-0.1,-0.1,0);
    glBegin(GL_POLYGON);
    glVertex2f(-0.075, -0.39);
    glVertex2f(-0.075, 0.1);
    glVertex2f(0.17, 0.1);
    glVertex2f(0.17, -0.39);
    glEnd();
    glFlush();

    glColor3f(0,1,0);//jendela
    glBegin(GL_POLYGON);
    glVertex2f(-0.25, -0.3);
    glVertex2f(-0.25, 0.025);
    glVertex2f(-0.55, 0.025);
    glVertex2f(-0.55, -0.3);
    glEnd();
    glFlush();

    glColor3f(1,0,0);
    glBegin(GL_LINE_LOOP);
    glVertex2f(-0.41, -0.3);
    glVertex2f(-0.41, 0.025);
    glEnd();
    glFlush();

    glBegin(GL_LINE_LOOP);
    glVertex2f(-0.55, -0.1);
    glVertex2f(-0.55, -0.1);
    glVertex2f(-0.25, -0.1);
    glVertex2f(-0.25, -0.1);
    glEnd();

    glFlush();
}


int main(int argc, char** argv){
    printf("DESAIN\n");
    printf("RUMAH");
    glutCreateWindow("RUMAH");
    glutDisplayFunc(Bangunan);
    glutMainLoop();
}

RUN :
Share:

0 komentar:

Posting Komentar

Popular Posts

Copyright © Diantarawk! | Powered by Blogger

Design by ThemePacific | Blogger Theme by NewBloggerThemes.com