adapun contoh code salah satu simbol diatas ialah :
void tampilsimbol(int i)
{
if(i%2==0){
glColor3f(1.0f,0.0f,1.0f); //warna pink
}else {glColor3f(0.0f,0.0f,1.0f);} // warna hitam
glBegin(GL_QUADS);//buat persegi warna putih/hitam
glVertex2d(0,0);
glVertex2d(0,10);
glVertex2d(10,10);
glVertex2d(10,0);
glEnd();
glColor3f(1.0f, 0.0f, 0.0f); //warna merah
glBegin(GL_LINE_STRIP); //buat garis segiempat
glVertex2d(0,0);
glVertex2d(0,10);
glVertex2d(10,10);
glVertex2d(10,0);
glEnd();
if(i%2==1){
glColor3f(1.0f,0.0f,1.0f); //warna pink
}else {glColor3f(0.0f,0.0f,1.0f);} // warna hitam
glBegin(GL_POLYGON); //buat objek
glVertex2d(4,4);
glVertex2d(5,1);
glVertex2d(6,4);
glVertex2d(9,5);
glVertex2d(6,6);
glVertex2d(5,9);
glVertex2d(4,6);
glVertex2d(1,5);
glVertex2d(4,5);
glEnd();
glFlush();
}
Tidak ada komentar:
Posting Komentar