Membuat Segitiga Sama Sisi

#include
#include
void Display()
{
     // [ Segitiga Sama Sisi ]   
     glClear(GL_COLOR_BUFFER_BIT);
     glBegin(GL_LINE_STRIP);
     glColor3f(0,0,0);
     glVertex2f(30,30);
     glColor3f(0,0,0);
     glVertex2f(130,30);
     glColor3f(0,0,0);
     glVertex2f(80,90);
     glColor3f(0,0,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(1,0,0,0);
     glPointSize(3);
     }
    
     int main(int args,char* argv[])
     {
         glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
         glutInitWindowSize(300,300);
         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