Berikut adalah sintak dari gambar TV tersebut. Selamat membaca....
Aplikasi yang saya gunakan sekarang adalah Microsoft Visual C++ 2010 Express tapi bisa juga digunakan untuk Microsoft Visual C++ 2008. Yaps tak perlu bicara panjang lebar lagi mari langsung saya bagikan sintak dari gambar TV seperti gambar diatas. Silahkan lihat dibawah ini:
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
/*Membuat Gambar Televisi */
void Gambarkotak1(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.7,0.8);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotak1_2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0,0,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotak2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0,0,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotak3(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.9,0.9,0.9);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotak4(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.8,0.8,0.8);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotak5(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.7,0.7);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Membuat gambar lantai
void lantai(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(1,1,1);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Membuat gambar pintu
void pintu(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.5,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void daunpintu(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Membuat gagang pintu
void pegangan(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.1,0.1,0.1);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Membuat garis --> fungsinya hanya untuk pembatas warna
void Garis(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_LINE_LOOP);
glColor3f(0,0,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Membuat Atasan Meja
void Gambarkotakmeja1(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakmeja2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakmeja3(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Menggambar kaki meja
void Gambarkotakkaki1(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakkaki1_2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.5,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakkaki2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakkaki2_2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.5,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakkaki3(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakkaki3_2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.5,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakkaki4(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarkotakkaki4_2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.5,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Menggambar bingkai jendela
void bingkaijendela(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(0.7,0.3,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Menggambar jendela
void Gambarjendela(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(1,1,1);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarjendela1(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(1,1,1);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarjendela2(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(1,1,1);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
void Gambarjendela3(int x1, int y1,int x2, int y2,int x3, int y3, int x4, int y4){
glBegin(GL_POLYGON);
glColor3f(1,1,1);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glVertex2i(x4,y4);
glEnd();
}
//Menggambar antena TV
void antena (int x1, int y1,int x2, int y2,int x3, int y3){
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
}
void userdraw(void) {
// Disini tempat untuk menggambar
lantai(-320,-240,-320,-20,320,-20,320,-240);
pintu(-150,220,-150,-20,-300,-20,-300,220);
daunpintu(-160,210,-160,-20,-290,-20,-290,210);
pegangan(-180,120,-180,130,-170,130,-170,120);
bingkaijendela(130,210,130,70,310,70,310,210);
Gambarjendela(300,200,300,80,230,80,230,200);
Gambarjendela1(210,200,210,80,140,80,140,200);
Gambarkotakkaki1(225,-200,225,-240,200,-240,200,-200);
Gambarkotakkaki1_2(190,-200,190,-240,200,-240,200,-200);
Gambarkotakkaki2(-130,-200,-130,-240,-155,-240,-155,-200);
Gambarkotakkaki2_2(-155,-200,-155,-240,-165,-240,-165,-200);
Gambarkotakkaki3(-175,-200,-175,-225,-200,-225,-200,-150);
Gambarkotakkaki3_2(-210,-130,-210,-200,-200,-225,-200,-150);
Gambarkotakkaki4(145,-200,145,-225,120,-225,120,-200);
Gambarkotakkaki4_2(108,-200,108,-203,120,-225,120,-200);
Gambarkotakmeja1(-175,-175,-225,-75,150,-75,250,-175);
Gambarkotakmeja2(-225,-100,-175,-200,-175,-175,-225,-75);
Gambarkotakmeja3(-175,-200,-175,-175,250,-175,250,-200);
//Koordinat garis sama dengan koordinat bentuk yang ingin diberi garis pembatas
Garis(225,-200,225,-240,200,-240,200,-200);
Garis(190,-200,190,-240,200,-240,200,-200);
Garis(-130,-200,-130,-240,-155,-240,-155,-200);
Garis(-155,-200,-155,-240,-165,-240,-165,-200);
Garis(-175,-200,-175,-225,-200,-225,-200,-150);
Garis(-210,-130,-210,-200,-200,-225,-200,-150);
Garis(145,-200,145,-225,120,-225,120,-200);
Garis(108,-200,108,-203,120,-225,120,-200);
Garis(-175,-175,-225,-75,150,-75,250,-175);
Garis(-225,-100,-175,-200,-175,-175,-225,-75);
Garis(-175,-200,-175,-175,250,-175,250,-200);
Garis(130,210,130,70,310,70,310,210);
Garis(-150,220,-150,-20,-300,-20,-300,220);
Garis(-160,210,-160,-20,-290,-20,-290,210);
Gambarkotak1(120,-135,120,-160,-120,-160,-120,-135);
Gambarkotak1_2(110,-142,110,-151,100,-151,100,-142);
Gambarkotak2(120,-135,120,50,-120,50,-120,-135);
Gambarkotak3(110,-125,110,40,-110,40,-110,-125);
Gambarkotak4(-120,-160,-160,-100,-160,100,-120,50);
Gambarkotak5(60,100,-160,100,-120,50,120,50);
antena(0,130,-20,80,-40,130);
glEnd();
}
void display(void) {
glClear( GL_COLOR_BUFFER_BIT);
userdraw();
glutSwapBuffers();
}
int main(int argc, char **argv){
glutInit(&argc,argv);
glutInitDisplayMode ( GLUT_DOUBLE | GLUT_RGB );
glutInitWindowPosition(100,100);
glutInitWindowSize(640,480);
glutCreateWindow ("Create By : Rochmad Dwi"); //Nama bisa diatur sendiri
glClearColor(0,1,0,0);//Untuk background warna hijau
gluOrtho2D(-320., 320., -240.0, 240.0);
glutIdleFunc(display);
glutDisplayFunc(display);
int();
glutMainLoop();
return 0;
}
Itulah sintak dalam membuat gambar TV menggunakan aplikasi Microsoft Visual C++, semoga postingan tadi bermanfaat. Untuk postingan lainnya dapat dilihat di Postingan Lainnya.
Silahkan tinggalkan komentar anda apabila perlu. Atas kunjungannya saya ucapkan terimakasih....
How To Use Spinning Rods in Your Home - Titanium
BalasHapusThe Tilt-Tilt Tilt is a lighter version titanium septum jewelry of titanium bikes the popular titanium pans Rod which is similar titanium ring to the original one with a titanium bicycle spinning