Monday, May 21, 2018

CONTOH CODING ANIMASI 2 D PERSEGI BANYAK MENGGUNAKAN MICROSOFT C++


#include<GL/glut.h>
#include<windows.h>

void myDisplay (void) {
float x1,y1,x2,y2,x3,y3,x4,y4;
int i,j;

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

x1=-0.9;
x2=-0.8;
x3=-0.8;
x4=-0.9;
y1=0.9;
y2=0.9;
y3=0.8;
y4=0.8;

for(i=1;i<9;i++)
{
for(j=1;j<9;j++)
{

glBegin(GL_POLYGON);
            glColor3f (255.0,255.0,255.0);
            glVertex2f (x1,y1);
            glVertex2f (x2,y2);
            glVertex2f (x3,y3);
            glVertex2f (x4,y4);

            x1+=0.2;
            x2+=0.2;
            x3+=0.2;
            x4+=0.2;

glEnd();
}

            y1-=0.2;
            y2-=0.2;
            y3-=0.2;
            y4-=0.2;

            x1=-0.9;
            x2=-0.8;
            x3=-0.8;
            x4=-0.9;

}
glutSwapBuffers();
            glFlush();
}
void main(int argc, char** argv){
            glutInit(&argc, argv);
            glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
            glutInitWindowPosition (0,0);
            glutInitWindowSize (1500,1500);
            glutCreateWindow ("Membuat Banyak Segi Empat");
            glutDisplayFunc (myDisplay);
            glutMainLoop();
}


No comments:

Post a Comment

CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++

CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++ #include<stdlib.h> #include<conio.h> #include<iostream.h> struc...