Membuat Segi Enam

#include
#include
void Display()
{
     // Membuat Garis Diagonal Meyimpang [ Segi enam Sama Sisi ]   
     glClear(GL_COLOR_BUFFER_BIT);
     glBegin(GL_LINE_STRIP);
     glColor3f(0,5,0);
     glVertex2f(30,30);
     glColor3f(0,1,0);
     glVertex2f(80,10);
     glColor3f(0,5,0);

     glVertex2f(130,30);
     glColor3f(0,5,0);
     glVertex2f(130,90);
     glColor3f(0,5,0);
     glVertex2f(80,112);
     glColor3f(0,5,0);
     glVertex2f(30,90);
     glColor3f(0,5,0);
     glVertex2f(30,30); 
     glEnd();
     glFlush();
}
void reshape(int x,int y)

     {
     glViewport(0,0,(GLsizei)x,(GLsizei)y);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     gluOrtho2D(0,160,0,120);
     }
    
     void init()
     {
     glClearColor(0,0,0,0);
     glPointSize(3);
     }
    
     int main(int args,char* argv[])
     {
         glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
         glutInitWindowSize(240,240);
         glutCreateWindow("Habibul Hakim [12111042]");
         init();
         glutDisplayFunc(Display);
         glutReshapeFunc(reshape);
         glutMainLoop();
     }

Post a Comment

1. Jangan lupa tinggalkan Likenya ya
2. Berkomentarlah dengan baik dan sopan

[blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget