Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glut.h>
- //mengaktifkan fungsi perhitungan matematika
- #include <math.h>
- #include <cmath>
- int dstTime = 0; // milliseconds
- struct Color
- {
- float r, g, b;
- };
- Color makeColor(float r, float g, float b)
- {
- Color c = { r, g, b };
- return c;
- };
- Color lerp(Color a, Color b, float t)
- {
- Color c;
- c.r = (1 - t) * a.r + t * b.r;
- c.g = (1 - t) * a.g + t * b.g;
- c.b = (1 - t) * a.b + t * b.b;
- return c;
- }
- static int timeFor = 0;
- //deklarasi pembuatan lingkaran
- const double PI = 3.142857143;
- int i, radius, jumlah_titik, x_tengah, y_tengah;
- //deklarasi gerakan otomatis
- int gerak = 0;
- bool atas = true;
- //rgb(0.07,0.38,0.56)
- //0.36, 0.54, 0.66
- //rgb(0.00,0.90,1.00)
- void tampil()
- {
- const int curTime = glutGet(GLUT_ELAPSED_TIME);
- // figure out how far along duration we are, between 0.0 and 1.0
- const float t = std::cos(float(curTime) * 0.00027) * 0.5 + 0.5;
- // interpolate between two colors
- Color curColor = lerp(makeColor(0.00, 0.90, 1.00), makeColor(0.07, 0.38, 0.56), t);
- glClearColor(curColor.r, curColor.g, curColor.b, 1);
- // glClear(GL_COLOR_BUFFER_BIT);
- // glutSwapBuffers();
- //perintah menghapus layar
- //glClear(GL_COLOR_BUFFER_BIT);
- ///////BAYANG////////
- //bayang1
- glColor3f(0.41, 0.41, 0.41);
- glBegin(GL_POLYGON);
- glVertex2f(-25.6848345783986, 58.2583838680072);
- glVertex2f(14.8784403820487, 58.2583838680072);
- glVertex2f(14.8784403820487, 3.7977699245881);
- glVertex2f(-25.6848345783986, 3.7977699245881);
- glEnd();
- glFlush();
- //bayang2
- glColor3f(0.41, 0.41, 0.41);
- glBegin(GL_POLYGON);
- glVertex2f(6.7851171976519, 58.5539496887254);
- glVertex2f(6.7851171976519, 65.7677447810346);
- glVertex2f(14.7804067582946, 65.7677447810346);
- glVertex2f(14.7804067582946, 58.5539496887254);
- glEnd();
- glFlush();
- //bayang3
- glColor3f(0.41, 0.41, 0.41);
- glBegin(GL_POLYGON);
- glVertex2f(12.740614110478, 40.0307286092);
- glVertex2f(60, 40);
- glVertex2f(60, 31);
- glVertex2f(12.6349539322358, 31.0072966553989);
- glEnd();
- glFlush();
- //bayang4
- glColor3f(0.41, 0.41, 0.41);
- glBegin(GL_POLYGON);
- glVertex2f(20, 40);
- glVertex2f(20.0603107455486, 58.2651258296417);
- glVertex2f(60.0673711502669, 58.284620863342);
- glVertex2f(60, 40);
- glEnd();
- glFlush();
- //bayang5
- glColor3f(0.41, 0.41, 0.41);
- glBegin(GL_POLYGON);
- glVertex2f(52.6836532342533, 40.1388417253855);
- glVertex2f(52.6895681344281, 65.25810260369);
- glVertex2f(60.0181713898393, 65.261071477137);
- glVertex2f(60, 40);
- glEnd();
- glFlush();
- /*glVertex2f(52.6895681344281, 65.25810260369);
- glVertex2f(60.0181713898393, 65.261071477137);
- glVertex2f(60, 31);
- glVertex2f(12.6349539322358, 31.0072966553989);*/
- glEnd();
- glFlush();
- /////GEDUNG BESAR//////////
- //gedung 1
- glColor3f(0.67, 0.67, 0.67);
- glBegin(GL_POLYGON);
- glVertex2f(-7.8513535566571, 3.7977699245881);
- glVertex2f(-7.851353556657, 61.9569410492472);
- glVertex2f(16.9543275729469, 61.9569410492472);
- glVertex2f(16.9543275729469, 3.7977699245881);
- glEnd();
- glFlush();
- //pintu
- glColor3f(0.0, 0.0, 0.0);
- glBegin(GL_POLYGON);
- glVertex2f(0.9865533846835, 3.9106660657593);
- glVertex2f(0.9865533846835, 9.2626553880784);
- glVertex2f(5.6385427070026, 9.2626553880784);
- glVertex2f(5.6385427070026, 3.9106660657593);
- glEnd();
- glFlush();
- //jendela kecil 1
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7919173153694, 53.9373474344403);
- glVertex2f(-4.7919173153694, 56.3893367567594);
- glVertex2f(-2.3399279930503, 56.3893367567594);
- glVertex2f(-2.3399279930503, 53.9373474344403);
- glEnd();
- glFlush();
- //jendela kecil 2
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.8230838136912, 48.1501389577261);
- glVertex2f(-4.8230838136912, 50.6021282800452);
- glVertex2f(-2.3710944913721, 50.6021282800452);
- glVertex2f(-2.3710944913721, 48.1501389577261);
- glEnd();
- glFlush();
- //jendela kecil 3
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7851029515167, 42.6429139424234);
- glVertex2f(-4.7851029515167, 45.0949032647425);
- glVertex2f(-2.3331136291976, 45.0949032647425);
- glVertex2f(-2.3331136291976, 42.6429139424234);
- glEnd();
- glFlush();
- //jendela kecil 4
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7604224429328, 36.7704172972917);
- glVertex2f(-4.7604224429328, 39.2224066196108);
- glVertex2f(-2.3084331206137, 39.2224066196108);
- glVertex2f(-2.3084331206137, 36.7704172972917);
- glEnd();
- glFlush();
- //jendela kecil 5
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7183078444682, 30.9164881107123);
- glVertex2f(-4.7183078444682, 33.3684774330314);
- glVertex2f(-2.2663185221491, 33.3684774330314);
- glVertex2f(-2.2663185221491, 30.9164881107123);
- glEnd();
- glFlush();
- //jendela kecil 6
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.8025370413974, 25.3994757118498);
- glVertex2f(-4.8025370413974, 27.8514650341688);
- glVertex2f(-2.3505477190783, 27.8514650341688);
- glVertex2f(-2.3505477190783, 25.3994757118498);
- glEnd();
- glFlush();
- //jendela kecil 7
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7619238465033, 19.5346789745466);
- glVertex2f(-4.7619238465033, 21.9866682968656);
- glVertex2f(-2.3099345241842, 21.9866682968656);
- glVertex2f(-2.3099345241842, 19.5346789745466);
- glEnd();
- glFlush();
- //jendela kecil 8
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7830514313818, 13.726676718908);
- glVertex2f(-4.7830514313818, 16.0259767213108);
- glVertex2f(-2.3347476384461, 16.0259767213108);
- glVertex2f(-2.3347476384461, 13.726676718908);
- glEnd();
- glFlush();
- //jendela kecil 9
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(11.0561275241909, 53.975038634141);
- glVertex2f(11.0561275241909, 56.4270279564601);
- glVertex2f(13.40811684651, 56.4270279564601);
- glVertex2f(13.40811684651, 53.975038634141);
- glEnd();
- glFlush();
- //jendela kecil 10
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.8230838136912 + 15.8480448396, 48.1501389577261 + 0.0376911997);
- glVertex2f(-4.8230838136912+ 15.8480448396, 50.6021282800452 + 0.0376911997);
- glVertex2f(-2.3710944913721+ 15.8480448396, 50.6021282800452 + 0.0376911997);
- glVertex2f(-2.3710944913721+ 15.8480448396, 48.1501389577261 + 0.0376911997);
- glEnd();
- glFlush();
- //jendela kecil 11
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7851029515167 + 15.8480448396, 42.6429139424234 + 0.0376911997);
- glVertex2f(-4.7851029515167 + 15.8480448396, 45.0949032647425 + 0.0376911997);
- glVertex2f(-2.3331136291976 + 15.8480448396, 45.0949032647425 + 0.0376911997);
- glVertex2f(-2.3331136291976 + 15.8480448396, 42.6429139424234 + 0.0376911997);
- glEnd();
- glFlush();
- //jendela kecil 12
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7604224429328 + 15.8480448396, 36.7704172972917 + 0.0376911997);
- glVertex2f(-4.7604224429328 + 15.8480448396, 39.2224066196108 + 0.0376911997);
- glVertex2f(-2.3084331206137 + 15.8480448396, 39.2224066196108 + 0.0376911997);
- glVertex2f(-2.3084331206137 + 15.8480448396, 36.7704172972917 + 0.0376911997);
- glEnd();
- glFlush();
- //jendela kecil 13
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7183078444682 + 15.8480448396, 30.9164881107123 + 0.0376911997);
- glVertex2f(-4.7183078444682 + 15.8480448396, 33.3684774330314 + 0.0376911997);
- glVertex2f(-2.2663185221491 + 15.8480448396, 33.3684774330314 + 0.0376911997);
- glVertex2f(-2.2663185221491 + 15.8480448396, 30.9164881107123 + 0.0376911997);
- glEnd();
- glFlush();
- //jendela kecil 14
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.8025370413974 + 15.8480448396, 25.3994757118498 + 0.0376911997);
- glVertex2f(-4.8025370413974 + 15.8480448396, 27.8514650341688 + 0.0376911997);
- glVertex2f(-2.3505477190783 + 15.8480448396, 27.8514650341688 + 0.0376911997);
- glVertex2f(-2.3505477190783 + 15.8480448396, 25.3994757118498 + 0.0376911997);
- glEnd();
- glFlush();
- //jendela kecil 15
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7619238465033 + 15.8480448396, 19.5346789745466 + 0.0376911997);
- glVertex2f(-4.7619238465033 + 15.8480448396, 21.9866682968656 + 0.0376911997);
- glVertex2f(-2.3099345241842 + 15.8480448396, 21.9866682968656 + 0.0376911997);
- glVertex2f(-2.3099345241842 + 15.8480448396, 19.5346789745466 + 0.0376911997);
- glEnd();
- glFlush();
- //jendela kecil 16
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(-4.7830514313818 + 15.8480448396, 13.726676718908 + 0.0376911997);
- glVertex2f(-4.7830514313818 + 15.8480448396, 16.0259767213108 + 0.0376911997);
- glVertex2f(-2.3347476384461 + 15.8480448396, 16.0259767213108 + 0.0376911997);
- glVertex2f(-2.3347476384461 + 15.8480448396, 13.726676718908 + 0.0376911997);
- glEnd();
- glFlush();
- //jendela besar 1
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0369897641786, 53.932171709106);
- glVertex2f(2.0369897641786, 56.4841610314251);
- glVertex2f(6.9889790864977, 56.4841610314251);
- glVertex2f(6.9889790864977, 53.932171709106);
- glEnd();
- glFlush();
- //jendela besar 2
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0419653291983, 48.1227787236287);
- glVertex2f(2.0419653291983, 50.6747680459478);
- glVertex2f(6.9939546515174, 50.6747680459478);
- glVertex2f(6.9939546515174, 48.1227787236287);
- glEnd();
- glFlush();
- //jendela besar 3
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299);
- glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299);
- glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299);
- glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299);
- glEnd();
- glFlush();
- //jendela besar 4
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299);
- glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299);
- glEnd();
- glFlush();
- //jendela besar 5
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299);
- glEnd();
- glFlush();
- //jendela besar 6
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glEnd();
- glFlush();
- //jendela besar 7
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glEnd();
- glFlush();
- //jendela besar 8
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
- glEnd();
- glFlush();
- //GEDUNG BESAR///
- glColor3f(0.67, 0.67, 0.67);
- glBegin(GL_POLYGON);
- glVertex2f(37.7907464870846, 3.2583591918809);
- glVertex2f(37.7907464870846, 61.6130021670603);
- glVertex2f(60.5964276166886, 61.6130021670603);
- glVertex2f(60.5964276166886, 3.2583591918809);
- glEnd();
- glFlush();
- //jendela 1
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.269907929601, 13.7567911330596);
- glVertex2f(41.269907929601, 16.2087804553787);
- glVertex2f(43.7218972519201, 16.2087804553787);
- glVertex2f(43.7218972519201, 13.7567911330596);
- glEnd();
- glFlush();
- //jendela 2
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.2614345370283, 19.6572880802316);
- glVertex2f(41.2614345370283, 22.1092774025507);
- glVertex2f(43.7134238593474, 22.1092774025507);
- glVertex2f(43.7134238593474, 19.6572880802316);
- glEnd();
- glFlush();
- //jendela 3
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695);
- glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695);
- glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695);
- glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695);
- glEnd();
- glFlush();
- //jendela 4
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695);
- glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela 5
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela 6
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela 7
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela 8
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela9
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067);
- glVertex2f(54.7960899456286, 16.2565853090258);
- glVertex2f(57.2480792679477, 16.2565853090258);
- glVertex2f(57.2480792679477, 13.8045959867067);
- glEnd();
- glFlush();
- //jendela10
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695);
- glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695);
- glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695);
- glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695);
- glEnd();
- glFlush();
- //jendela11
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695);
- glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela12
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela13
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela14
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela15
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela16
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
- glEnd();
- glFlush();
- //jendela besar 1
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769);
- glVertex2f(47.0968939348456, 57.516649898596);
- glVertex2f(51.7488832571647, 57.516649898596);
- glVertex2f(51.7488832571647, 55.0646605762769);
- glEnd();
- glFlush();
- //jendela besar 2
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695);
- glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695);
- glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695);
- glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695);
- glEnd();
- glFlush();
- //jendela besar 3
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695);
- glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695);
- glEnd();
- glFlush();
- //jendela besar 4
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695);
- glEnd();
- glFlush();
- //jendela besar 5
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glEnd();
- glFlush();
- //jendela besar 6
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glEnd();
- glFlush();
- //jendela besar 7
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glEnd();
- glFlush();
- //jendela besar 8
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
- glEnd();
- glFlush();
- //pintu
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(46.9280382963844, 3.9841111539729);
- glVertex2f(46.9280382963844, 9.336100476292);
- glVertex2f(51.5800276187035, 9.336100476292);
- glVertex2f(51.5800276187035, 3.9841111539729);
- glEnd();
- glFlush();
- /////// GEDUNG KECIL//////
- //gedung kecil 1
- glColor3f(0.70, 0.75, 0.71);
- glBegin(GL_POLYGON);
- glVertex2f(15.2, 4);
- glVertex2f(15.2, 32);
- glVertex2f(37.8, 32);
- glVertex2f(37.8, 4);
- glEnd();
- glFlush();
- //jendela 1
- glColor3f(0.0, 0.0, 0.0);
- glBegin(GL_POLYGON);
- glVertex2f(18.1533263322379, 25.6619394489688);
- glVertex2f(18.1465447981508, 28.0111331988837);
- glVertex2f(20.7160831503269, 28.0111331988837);
- glVertex2f(20.7160831503269, 25.6619394489688);
- glEnd();
- glFlush();
- //jendela 2
- glColor3f(0.0, 0.0, 0.0);
- glBegin(GL_POLYGON);
- glVertex2f(18.2730245855641, 19.6083196536063);
- glVertex2f(20.7250139078832, 19.6083196536063);
- glVertex2f(20.7250139078832, 22.0603089759254);
- glVertex2f(18.2730245855641, 22.0603089759254);
- glEnd();
- glFlush();
- //jendela 3
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(18.2723039594753, 13.7482168358247);
- glVertex2f(18.2723039594753, 16.2002061581438);
- glVertex2f(20.7242932817944, 16.2002061581438);
- glVertex2f(20.7242932817944, 13.7482168358247);
- glEnd();
- glFlush();
- //jendela 4
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(31.9374696626437, 25.3699828721337);
- glVertex2f(31.9374696626437, 27.8219721944528);
- glVertex2f(34.3894589849628, 27.8219721944528);
- glVertex2f(34.3894589849628, 25.3699828721337);
- glEnd();
- glFlush();
- //jendela 5
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(31.9701621292047, 19.6161087574081);
- glVertex2f(31.9701621292047, 22.0680980797272);
- glVertex2f(34.4221514515238, 22.0680980797272);
- glVertex2f(34.4221514515238, 19.6161087574081);
- glEnd();
- glFlush();
- //jendela 6
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(32.0355470623266, 13.8295421761215);
- glVertex2f(32.0355470623266, 16.2815314984406);
- glVertex2f(34.4875363846457, 16.2815314984406);
- glVertex2f(34.4875363846457, 13.8295421761215);
- glEnd();
- glFlush();
- //jendela besar rumah1 1
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(24.1166690442812, 25.5255028566319);
- glVertex2f(24.1166690442812, 27.977492178951);
- glVertex2f(28.7686583666003, 27.977492178951);
- glVertex2f(28.7686583666003, 25.5255028566319);
- glEnd();
- glFlush();
- //jendela besar rumah1 2
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(24.1372191772075, 19.6575413746567);
- glVertex2f(24.1372191772075, 22.1095306969758);
- glVertex2f(28.7892084995266, 22.1095306969758);
- glVertex2f(28.7892084995266, 19.6575413746567);
- glEnd();
- glFlush();
- //jendela besar rumah1 3
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(24.1694254028489, 13.7936993468023);
- glVertex2f(24.1694254028489, 16.2456886691214);
- glVertex2f(28.821414725168, 16.2456886691214);
- glVertex2f(28.821414725168, 13.7936993468023);
- glEnd();
- glFlush();
- //pintu rumah1
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(23.9932204416424, 4.019791369435);
- glVertex2f(23.9932204416424, 9.3717806917541);
- glVertex2f(28.6452097639615, 9.3717806917541);
- glVertex2f(28.6452097639615, 4.019791369435);
- glEnd();
- glFlush();
- ////------------gedung 2--------------/////
- glColor3f(0.70, 0.75, 0.71);
- glBegin(GL_POLYGON);
- glVertex2f(63.177182086235, 4.0498582903215);
- glVertex2f(63.177182086235, 32.1498582903215);
- glVertex2f(85.777182086235, 32.1498582903215);
- glVertex2f(85.777182086235, 4.0498582903215);
- glEnd();
- glFlush();
- //jendela 1
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(66.4280728630853, 25.6420228971954);
- glVertex2f(66.4280728630853, 28.0940122195145);
- glVertex2f(68.8800621854044, 28.0940122195145);
- glVertex2f(68.8800621854044, 25.6420228971954);
- glEnd();
- glFlush();
- //jendela 2
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(66.3537713360208, 19.6979007320387);
- glVertex2f(66.3537713360208, 22.1498900543578);
- glVertex2f(68.8057606583399, 22.1498900543578);
- glVertex2f(68.8057606583399, 19.6979007320387);
- glEnd();
- glFlush();
- //jendela 2
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(66.3537713360208, 19.6979007320387);
- glVertex2f(66.3537713360208, 22.1498900543578);
- glVertex2f(68.8057606583399, 22.1498900543578);
- glVertex2f(68.8057606583399, 19.6979007320387);
- glEnd();
- glFlush();
- //jendela 3
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(66.5766759172142, 13.9023816210109);
- glVertex2f(66.5766759172142, 16.35437094333);
- glVertex2f(69.0286652395333, 16.35437094333);
- glVertex2f(69.0286652395333, 13.9023816210109);
- glEnd();
- glFlush();
- //jendela 4
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(80.2481568970748, 25.6420228971954);
- glVertex2f(80.2481568970748, 28.0940122195145);
- glVertex2f(82.7001462193939, 28.0940122195145);
- glVertex2f(82.7001462193939, 25.6420228971954);
- glEnd();
- glFlush();
- //jendela 5
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(80.2123788293953, 19.7338985689341);
- glVertex2f(80.2123788293953, 22.1858878912532);
- glVertex2f(82.6643681517145, 22.1858878912532);
- glVertex2f(82.6643681517145, 19.7338985689341);
- glEnd();
- glFlush();
- //jendela 6
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(80.2850123226567, 14.032169347923);
- glVertex2f(80.2850123226567, 16.4841586702421);
- glVertex2f(82.7370016449758, 16.4841586702421);
- glVertex2f(82.7370016449758, 14.032169347923);
- glEnd();
- glFlush();
- //jendela besar 1
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(72.1664885100119, 25.5170060689998);
- glVertex2f(72.1664885100119, 27.9689953913189);
- glVertex2f(76.818477832331, 27.9689953913189);
- glVertex2f(76.818477832331, 25.5170060689998);
- glEnd();
- glFlush();
- //jendela besar 2
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(72.1186550669397, 19.6986161578653);
- glVertex2f(72.1186550669397, 22.1506054801844);
- glVertex2f(76.7706443892588, 22.1506054801844);
- glVertex2f(76.7706443892588, 19.6986161578653);
- glEnd();
- glFlush();
- //jendela besar 3
- glColor3f(1.00, 1.00, 0.20);
- glBegin(GL_POLYGON);
- glVertex2f(72.1567930427048, 13.8635058658061);
- glVertex2f(72.1567930427048, 16.3154951881252);
- glVertex2f(76.8087823650239, 16.3154951881252);
- glVertex2f(76.8087823650239, 13.8635058658061);
- glEnd();
- glFlush();
- //pintu
- glColor3f(0.00, 0.00, 0.00);
- glBegin(GL_POLYGON);
- glVertex2f(72.0720115699144, 4.0426982071601);
- glVertex2f(72.0720115699144, 9.4946875294792);
- glVertex2f(76.7240008922335, 9.4946875294792);
- glVertex2f(76.7240008922335, 4.0426982071601);
- glEnd();
- glFlush();
- //tanah
- glColor3f(0.33, 0.33, 0.33);
- glBegin(GL_POLYGON);
- glVertex2f(-30, -30);
- glVertex2f(-30, 4);
- glVertex2f(100, 4);
- glVertex2f(100, -30);
- glEnd();
- glFlush();
- //perintah animasi
- glPushMatrix();
- glTranslatef(gerak, 0, 0);
- /*
- glColor3f(0.0, 1.0, 1.0);
- glBegin(GL_POLYGON);
- glVertex2f(1.0, 1.0);
- glVertex2f(1.5, 0.0);
- glVertex2f(1.5, -1.0);
- glVertex2f(-1.0, -1.0);
- glVertex2f(-1.0, 0.0);
- glVertex2f(-0.7, 1.0);
- glEnd();
- glFlush();
- */
- glColor3f(255.0, 255.0, 0.0);
- glBegin(GL_POLYGON);
- radius = 400;
- jumlah_titik = 300;
- x_tengah = 100;
- y_tengah = 8000;
- for (i = 0; i <= 360; i++)
- {
- float sudut = i * (2 * PI / jumlah_titik);
- float x = x_tengah + radius * cos(sudut);
- float y = y_tengah + radius * sin(sudut);
- glVertex2f(x / 100, y / 100);
- }
- glEnd();
- glFlush();
- glPopMatrix();
- }
- void timer(int t)
- {
- gerak += 1;
- glutPostRedisplay();
- glutTimerFunc(130, timer, 0);
- }
- void timeer(int value)
- {
- glutTimerFunc(9999999, timeer, 0);
- glutPostRedisplay();
- }
- void display() {
- glClear(GL_COLOR_BUFFER_BIT);
- tampil();
- glFlush();
- glutSwapBuffers();
- }
- int main(int argc, char** argv)
- {pa
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(600, 600);
- glutCreateWindow("Bulan");
- glutPostRedisplay();
- glutDisplayFunc(display);
- gluOrtho2D(-20., 100., -20.0, 100.0);
- // glutTimerFunc(0, timeer, 0);
- glutTimerFunc(0, timer, 0);
- glutMainLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement