Advertisement
extreme404

Untitled

Nov 21st, 2019
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <GL/glut.h>
  4. #include <cmath>
  5.  
  6. typedef struct {
  7. float m[3][3];
  8. } matrix2D_t;
  9.  
  10. typedef struct {
  11. float v[3];
  12. } vector2D_t;
  13.  
  14. typedef struct {
  15. float x;
  16. float y;
  17. } point2D_t;
  18.  
  19. typedef struct {
  20. float r;
  21. float g;
  22. float b;
  23. } color_t;
  24.  
  25. matrix2D_t createIdentity(void)
  26. {
  27. matrix2D_t u;
  28. int i, j;
  29. for (i = 0; i < 3; i++) {
  30. for (j = 0; j < 3; j++) u.m[i][j] = 0.;
  31. u.m[i][i] = 1.;
  32. }
  33. return u;
  34. }
  35.  
  36. matrix2D_t multiply(matrix2D_t a, matrix2D_t b)
  37. {
  38. matrix2D_t c;//c=a*b
  39. int i, j, k;
  40. for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) {
  41. c.m[i][j] = 0;
  42. for (k = 0; k < 3; k++) c.m[i][j] += a.m[i][k] * b.m[k][j];
  43. }
  44. return c;
  45. }
  46.  
  47. vector2D_t multiply(matrix2D_t a, vector2D_t b)
  48. {
  49. vector2D_t c;//c=a*b
  50. int i, j;
  51. for (i = 0; i < 3; i++) {
  52. c.v[i] = 0;
  53. for (j = 0; j < 3; j++) c.v[i] += a.m[i][j] * b.v[j];
  54. }
  55. return c;
  56. }
  57.  
  58. matrix2D_t translationMTX(float dx, float dy)
  59. {
  60. matrix2D_t trans = createIdentity();
  61. trans.m[0][2] = dx;
  62. trans.m[1][2] = dy;
  63. return trans;
  64. }
  65.  
  66. matrix2D_t rotationMTX(float theta)
  67. {
  68. matrix2D_t rotate = createIdentity();
  69. float cs = cos(theta);
  70. float sn = sin(theta);
  71. rotate.m[0][0] = cs; rotate.m[0][1] = -sn;
  72. rotate.m[1][0] = sn; rotate.m[1][1] = cs;
  73. return rotate;
  74. }
  75.  
  76. matrix2D_t scalingMTX(float factorx, float factory)
  77. {
  78. matrix2D_t scale = createIdentity();
  79. scale.m[0][0] = factorx;
  80. scale.m[1][1] = factory;
  81. return scale;
  82. }
  83.  
  84. point2D_t Vector2Point(vector2D_t vec)
  85. {
  86. point2D_t pnt;
  87. pnt.x = vec.v[0];
  88. pnt.y = vec.v[1];
  89. return pnt;
  90. }
  91.  
  92. vector2D_t Point2Vector(point2D_t pnt)
  93. {
  94. vector2D_t vec;
  95. vec.v[0] = pnt.x;
  96. vec.v[1] = pnt.y;
  97. vec.v[2] = 1.;
  98. return vec;
  99. }
  100.  
  101. void setColor(float red, float green, float blue)
  102. {
  103. glColor3f(red, green, blue);
  104. }
  105.  
  106. void setColor(color_t col)
  107. {
  108. glColor3f(col.r, col.g, col.b);
  109. }
  110.  
  111. void drawDot(float x, float y)
  112. {
  113. glBegin(GL_POINTS);
  114. glVertex2f(x, y);
  115. glEnd();
  116. }
  117.  
  118. void drawLine(float x1, float y1, float x2, float y2)
  119. {
  120. glBegin(GL_LINES);
  121. glVertex2f(x1, y1);
  122. glVertex2f(x2, y2);
  123. glEnd();
  124. }
  125.  
  126. void drawLine(point2D_t p1, point2D_t p2)
  127. {
  128. drawLine(p1.x, p1.y, p2.x, p2.y);
  129. }
  130.  
  131. void drawPolyline(point2D_t pnt[], int n)
  132. {
  133. int i;
  134. glBegin(GL_LINE_STRIP);
  135. for (i = 0; i < n; i++) {
  136. glVertex2f(pnt[i].x, pnt[i].y);
  137. }
  138. glEnd();
  139. }
  140.  
  141. void drawPolygon(point2D_t pnt[], int n)
  142. {
  143. int i;
  144. glBegin(GL_LINE_LOOP);
  145. for (i = 0; i < n; i++) {
  146. glVertex2f(pnt[i].x, pnt[i].y);
  147. }
  148. glEnd();
  149. }
  150.  
  151. void fillPolygon(point2D_t pnt[], int n, color_t color)
  152. {
  153. int i;
  154. setColor(color);
  155. glBegin(GL_POLYGON);
  156. for (i = 0; i < n; i++) {
  157. glVertex2f(pnt[i].x, pnt[i].y);
  158. }
  159. glEnd();
  160. }
  161.  
  162. void gradatePolygon(point2D_t pnt[], color_t col[], int num)
  163. {
  164. int i;
  165. glBegin(GL_POLYGON);
  166. for (i = 0; i < num; i++) {
  167. setColor(col[i]);
  168. glVertex2f(pnt[i].x, pnt[i].y);
  169. }
  170. glEnd();
  171. }
  172.  
  173.  
  174. void userdraw(void);
  175.  
  176.  
  177. void drawcharX(float x, float y)
  178. {
  179. drawLine(x, y, x + 10, y + 12); drawLine(x, y + 12, x + 10, y);
  180. }
  181.  
  182. void drawcharY(float x, float y)
  183. {
  184. drawLine(x + 5, y, x + 5, y + 7); drawLine(x, y + 12, x + 5, y + 7); drawLine(x + 10, y + 12, x + 5, y + 7);
  185. }
  186.  
  187. void drawAxes(void)
  188. {
  189. drawLine(-310, 0, 310, 0); drawLine(310, 0, 300, 5); drawLine(310, 0, 300, -5);
  190. drawcharX(300, -20);
  191. drawLine(0, -230, 0, 230); drawLine(0, 230, 5, 220); drawLine(0, 230, -5, 220);
  192. drawcharY(-20, 220);
  193. }
  194.  
  195. int dstTime = 0; // milliseconds
  196.  
  197. struct Color
  198. {
  199. float r, g, b;
  200. };
  201.  
  202. Color makeColor(float r, float g, float b)
  203. {
  204. Color c = { r, g, b };
  205. return c;
  206. };
  207.  
  208. Color lerp(Color a, Color b, float t)
  209. {
  210. Color c;
  211. c.r = (1 - t) * a.r + t * b.r;
  212. c.g = (1 - t) * a.g + t * b.g;
  213. c.b = (1 - t) * a.b + t * b.b;
  214.  
  215. return c;
  216. }
  217.  
  218.  
  219. static int timeFor = 0;
  220. //deklarasi pembuatan lingkaran
  221. const double PI = 3.142857143;
  222. int i, radius, jumlah_titik, x_tengah, y_tengah;
  223.  
  224. //deklarasi gerakan otomatis
  225. int gerak = 0;
  226. bool atas = true;
  227.  
  228.  
  229.  
  230. void tampil()
  231. {
  232.  
  233.  
  234. const int curTime = glutGet(GLUT_ELAPSED_TIME);
  235.  
  236. // durasi
  237. const float t = std::cos(float(curTime) * 0.00027) * 0.5 + 0.5;
  238.  
  239. // interpolasi antar 2 warna
  240. Color curColor = lerp(makeColor(0.00, 0.90, 1.00), makeColor(0.07, 0.38, 0.56), t);
  241.  
  242. glClearColor(curColor.r, curColor.g, curColor.b, 1);
  243.  
  244. ///////BAYANG////////
  245.  
  246. //bayang1
  247. glColor3f(0.41, 0.41, 0.41);
  248. glBegin(GL_POLYGON);
  249. glVertex2f(-25.6848345783986, 58.2583838680072);
  250. glVertex2f(14.8784403820487, 58.2583838680072);
  251. glVertex2f(14.8784403820487, 3.7977699245881);
  252. glVertex2f(-25.6848345783986, 3.7977699245881);
  253. glEnd();
  254. glFlush();
  255.  
  256. //bayang2
  257. glColor3f(0.41, 0.41, 0.41);
  258. glBegin(GL_POLYGON);
  259. glVertex2f(6.7851171976519, 58.5539496887254);
  260. glVertex2f(6.7851171976519, 65.7677447810346);
  261. glVertex2f(14.7804067582946, 65.7677447810346);
  262. glVertex2f(14.7804067582946, 58.5539496887254);
  263. glEnd();
  264. glFlush();
  265.  
  266. //bayang3
  267. glColor3f(0.41, 0.41, 0.41);
  268. glBegin(GL_POLYGON);
  269. glVertex2f(12.740614110478, 40.0307286092);
  270. glVertex2f(60, 40);
  271. glVertex2f(60, 31);
  272. glVertex2f(12.6349539322358, 31.0072966553989);
  273. glEnd();
  274. glFlush();
  275.  
  276. //bayang4
  277. glColor3f(0.41, 0.41, 0.41);
  278. glBegin(GL_POLYGON);
  279. glVertex2f(20, 40);
  280. glVertex2f(20.0603107455486, 58.2651258296417);
  281. glVertex2f(60.0673711502669, 58.284620863342);
  282. glVertex2f(60, 40);
  283. glEnd();
  284. glFlush();
  285.  
  286. //bayang5
  287. glColor3f(0.41, 0.41, 0.41);
  288. glBegin(GL_POLYGON);
  289. glVertex2f(52.6836532342533, 40.1388417253855);
  290. glVertex2f(52.6895681344281, 65.25810260369);
  291. glVertex2f(60.0181713898393, 65.261071477137);
  292. glVertex2f(60, 40);
  293. glEnd();
  294. glFlush();
  295. /*glVertex2f(52.6895681344281, 65.25810260369);
  296. glVertex2f(60.0181713898393, 65.261071477137);
  297. glVertex2f(60, 31);
  298. glVertex2f(12.6349539322358, 31.0072966553989);*/
  299. glEnd();
  300. glFlush();
  301.  
  302. /////GEDUNG BESAR//////////
  303.  
  304. //gedung 1
  305. glColor3f(0.67, 0.67, 0.67);
  306. glBegin(GL_POLYGON);
  307. glVertex2f(-7.8513535566571, 3.7977699245881);
  308. glVertex2f(-7.851353556657, 61.9569410492472);
  309. glVertex2f(16.9543275729469, 61.9569410492472);
  310. glVertex2f(16.9543275729469, 3.7977699245881);
  311. glEnd();
  312. glFlush();
  313.  
  314. //pintu
  315. glColor3f(0.0, 0.0, 0.0);
  316. glBegin(GL_POLYGON);
  317. glVertex2f(0.9865533846835, 3.9106660657593);
  318. glVertex2f(0.9865533846835, 9.2626553880784);
  319. glVertex2f(5.6385427070026, 9.2626553880784);
  320. glVertex2f(5.6385427070026, 3.9106660657593);
  321. glEnd();
  322. glFlush();
  323.  
  324.  
  325. //jendela kecil 1
  326. glColor3f(1.00, 1.00, 0.20);
  327. glBegin(GL_POLYGON);
  328. glVertex2f(-4.7919173153694, 53.9373474344403);
  329. glVertex2f(-4.7919173153694, 56.3893367567594);
  330. glVertex2f(-2.3399279930503, 56.3893367567594);
  331. glVertex2f(-2.3399279930503, 53.9373474344403);
  332. glEnd();
  333. glFlush();
  334.  
  335. //jendela kecil 2
  336. glColor3f(1.00, 1.00, 0.20);
  337. glBegin(GL_POLYGON);
  338. glVertex2f(-4.8230838136912, 48.1501389577261);
  339. glVertex2f(-4.8230838136912, 50.6021282800452);
  340. glVertex2f(-2.3710944913721, 50.6021282800452);
  341. glVertex2f(-2.3710944913721, 48.1501389577261);
  342. glEnd();
  343. glFlush();
  344.  
  345. //jendela kecil 3
  346. glColor3f(1.00, 1.00, 0.20);
  347. glBegin(GL_POLYGON);
  348. glVertex2f(-4.7851029515167, 42.6429139424234);
  349. glVertex2f(-4.7851029515167, 45.0949032647425);
  350. glVertex2f(-2.3331136291976, 45.0949032647425);
  351. glVertex2f(-2.3331136291976, 42.6429139424234);
  352. glEnd();
  353. glFlush();
  354.  
  355. //jendela kecil 4
  356. glColor3f(1.00, 1.00, 0.20);
  357. glBegin(GL_POLYGON);
  358. glVertex2f(-4.7604224429328, 36.7704172972917);
  359. glVertex2f(-4.7604224429328, 39.2224066196108);
  360. glVertex2f(-2.3084331206137, 39.2224066196108);
  361. glVertex2f(-2.3084331206137, 36.7704172972917);
  362. glEnd();
  363. glFlush();
  364.  
  365. //jendela kecil 5
  366. glColor3f(1.00, 1.00, 0.20);
  367. glBegin(GL_POLYGON);
  368. glVertex2f(-4.7183078444682, 30.9164881107123);
  369. glVertex2f(-4.7183078444682, 33.3684774330314);
  370. glVertex2f(-2.2663185221491, 33.3684774330314);
  371. glVertex2f(-2.2663185221491, 30.9164881107123);
  372. glEnd();
  373. glFlush();
  374.  
  375. //jendela kecil 6
  376. glColor3f(1.00, 1.00, 0.20);
  377. glBegin(GL_POLYGON);
  378. glVertex2f(-4.8025370413974, 25.3994757118498);
  379. glVertex2f(-4.8025370413974, 27.8514650341688);
  380. glVertex2f(-2.3505477190783, 27.8514650341688);
  381. glVertex2f(-2.3505477190783, 25.3994757118498);
  382. glEnd();
  383. glFlush();
  384.  
  385. //jendela kecil 7
  386. glColor3f(1.00, 1.00, 0.20);
  387. glBegin(GL_POLYGON);
  388. glVertex2f(-4.7619238465033, 19.5346789745466);
  389. glVertex2f(-4.7619238465033, 21.9866682968656);
  390. glVertex2f(-2.3099345241842, 21.9866682968656);
  391. glVertex2f(-2.3099345241842, 19.5346789745466);
  392. glEnd();
  393. glFlush();
  394.  
  395. //jendela kecil 8
  396. glColor3f(1.00, 1.00, 0.20);
  397. glBegin(GL_POLYGON);
  398. glVertex2f(-4.7830514313818, 13.726676718908);
  399. glVertex2f(-4.7830514313818, 16.0259767213108);
  400. glVertex2f(-2.3347476384461, 16.0259767213108);
  401. glVertex2f(-2.3347476384461, 13.726676718908);
  402. glEnd();
  403. glFlush();
  404.  
  405. //jendela kecil 9
  406. glColor3f(1.00, 1.00, 0.20);
  407. glBegin(GL_POLYGON);
  408. glVertex2f(11.0561275241909, 53.975038634141);
  409. glVertex2f(11.0561275241909, 56.4270279564601);
  410. glVertex2f(13.40811684651, 56.4270279564601);
  411. glVertex2f(13.40811684651, 53.975038634141);
  412. glEnd();
  413. glFlush();
  414.  
  415. //jendela kecil 10
  416. glColor3f(1.00, 1.00, 0.20);
  417. glBegin(GL_POLYGON);
  418. glVertex2f(-4.8230838136912 + 15.8480448396, 48.1501389577261 + 0.0376911997);
  419. glVertex2f(-4.8230838136912 + 15.8480448396, 50.6021282800452 + 0.0376911997);
  420. glVertex2f(-2.3710944913721 + 15.8480448396, 50.6021282800452 + 0.0376911997);
  421. glVertex2f(-2.3710944913721 + 15.8480448396, 48.1501389577261 + 0.0376911997);
  422. glEnd();
  423. glFlush();
  424.  
  425. //jendela kecil 11
  426. glColor3f(1.00, 1.00, 0.20);
  427. glBegin(GL_POLYGON);
  428. glVertex2f(-4.7851029515167 + 15.8480448396, 42.6429139424234 + 0.0376911997);
  429. glVertex2f(-4.7851029515167 + 15.8480448396, 45.0949032647425 + 0.0376911997);
  430. glVertex2f(-2.3331136291976 + 15.8480448396, 45.0949032647425 + 0.0376911997);
  431. glVertex2f(-2.3331136291976 + 15.8480448396, 42.6429139424234 + 0.0376911997);
  432. glEnd();
  433. glFlush();
  434.  
  435. //jendela kecil 12
  436. glColor3f(1.00, 1.00, 0.20);
  437. glBegin(GL_POLYGON);
  438. glVertex2f(-4.7604224429328 + 15.8480448396, 36.7704172972917 + 0.0376911997);
  439. glVertex2f(-4.7604224429328 + 15.8480448396, 39.2224066196108 + 0.0376911997);
  440. glVertex2f(-2.3084331206137 + 15.8480448396, 39.2224066196108 + 0.0376911997);
  441. glVertex2f(-2.3084331206137 + 15.8480448396, 36.7704172972917 + 0.0376911997);
  442. glEnd();
  443. glFlush();
  444.  
  445. //jendela kecil 13
  446. glColor3f(1.00, 1.00, 0.20);
  447. glBegin(GL_POLYGON);
  448. glVertex2f(-4.7183078444682 + 15.8480448396, 30.9164881107123 + 0.0376911997);
  449. glVertex2f(-4.7183078444682 + 15.8480448396, 33.3684774330314 + 0.0376911997);
  450. glVertex2f(-2.2663185221491 + 15.8480448396, 33.3684774330314 + 0.0376911997);
  451. glVertex2f(-2.2663185221491 + 15.8480448396, 30.9164881107123 + 0.0376911997);
  452. glEnd();
  453. glFlush();
  454.  
  455. //jendela kecil 14
  456. glColor3f(1.00, 1.00, 0.20);
  457. glBegin(GL_POLYGON);
  458. glVertex2f(-4.8025370413974 + 15.8480448396, 25.3994757118498 + 0.0376911997);
  459. glVertex2f(-4.8025370413974 + 15.8480448396, 27.8514650341688 + 0.0376911997);
  460. glVertex2f(-2.3505477190783 + 15.8480448396, 27.8514650341688 + 0.0376911997);
  461. glVertex2f(-2.3505477190783 + 15.8480448396, 25.3994757118498 + 0.0376911997);
  462. glEnd();
  463. glFlush();
  464.  
  465. //jendela kecil 15
  466. glColor3f(1.00, 1.00, 0.20);
  467. glBegin(GL_POLYGON);
  468. glVertex2f(-4.7619238465033 + 15.8480448396, 19.5346789745466 + 0.0376911997);
  469. glVertex2f(-4.7619238465033 + 15.8480448396, 21.9866682968656 + 0.0376911997);
  470. glVertex2f(-2.3099345241842 + 15.8480448396, 21.9866682968656 + 0.0376911997);
  471. glVertex2f(-2.3099345241842 + 15.8480448396, 19.5346789745466 + 0.0376911997);
  472. glEnd();
  473. glFlush();
  474.  
  475. //jendela kecil 16
  476. glColor3f(1.00, 1.00, 0.20);
  477. glBegin(GL_POLYGON);
  478. glVertex2f(-4.7830514313818 + 15.8480448396, 13.726676718908 + 0.0376911997);
  479. glVertex2f(-4.7830514313818 + 15.8480448396, 16.0259767213108 + 0.0376911997);
  480. glVertex2f(-2.3347476384461 + 15.8480448396, 16.0259767213108 + 0.0376911997);
  481. glVertex2f(-2.3347476384461 + 15.8480448396, 13.726676718908 + 0.0376911997);
  482. glEnd();
  483. glFlush();
  484.  
  485. //jendela besar 1
  486. glColor3f(1.00, 1.00, 0.20);
  487. glBegin(GL_POLYGON);
  488. glVertex2f(2.0369897641786, 53.932171709106);
  489. glVertex2f(2.0369897641786, 56.4841610314251);
  490. glVertex2f(6.9889790864977, 56.4841610314251);
  491. glVertex2f(6.9889790864977, 53.932171709106);
  492. glEnd();
  493. glFlush();
  494.  
  495. //jendela besar 2
  496. glColor3f(1.00, 1.00, 0.20);
  497. glBegin(GL_POLYGON);
  498. glVertex2f(2.0419653291983, 48.1227787236287);
  499. glVertex2f(2.0419653291983, 50.6747680459478);
  500. glVertex2f(6.9939546515174, 50.6747680459478);
  501. glVertex2f(6.9939546515174, 48.1227787236287);
  502. glEnd();
  503. glFlush();
  504.  
  505. //jendela besar 3
  506. glColor3f(1.00, 1.00, 0.20);
  507. glBegin(GL_POLYGON);
  508. glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299);
  509. glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299);
  510. glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299);
  511. glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299);
  512. glEnd();
  513. glFlush();
  514.  
  515. //jendela besar 4
  516. glColor3f(1.00, 1.00, 0.20);
  517. glBegin(GL_POLYGON);
  518. glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299);
  519. glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299);
  520. glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299);
  521. glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299);
  522. glEnd();
  523. glFlush();
  524.  
  525. //jendela besar 5
  526. glColor3f(1.00, 1.00, 0.20);
  527. glBegin(GL_POLYGON);
  528. glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299);
  529. glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299);
  530. glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299);
  531. glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299);
  532. glEnd();
  533. glFlush();
  534.  
  535. //jendela besar 6
  536. glColor3f(1.00, 1.00, 0.20);
  537. glBegin(GL_POLYGON);
  538. glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  539. glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  540. glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  541. glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  542. glEnd();
  543. glFlush();
  544.  
  545. //jendela besar 7
  546. glColor3f(1.00, 1.00, 0.20);
  547. glBegin(GL_POLYGON);
  548. glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  549. glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  550. glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  551. glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  552. glEnd();
  553. glFlush();
  554.  
  555. //jendela besar 8
  556. glColor3f(1.00, 1.00, 0.20);
  557. glBegin(GL_POLYGON);
  558. glVertex2f(2.0419653291983, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  559. glVertex2f(2.0419653291983, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  560. glVertex2f(6.9939546515174, 50.6747680459478 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  561. glVertex2f(6.9939546515174, 48.1227787236287 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299 - 5.80939299);
  562. glEnd();
  563. glFlush();
  564.  
  565. //GEDUNG BESAR///
  566. glColor3f(0.67, 0.67, 0.67);
  567. glBegin(GL_POLYGON);
  568. glVertex2f(37.7907464870846, 3.2583591918809);
  569. glVertex2f(37.7907464870846, 61.6130021670603);
  570. glVertex2f(60.5964276166886, 61.6130021670603);
  571. glVertex2f(60.5964276166886, 3.2583591918809);
  572. glEnd();
  573. glFlush();
  574.  
  575. //jendela 1
  576. glColor3f(1.00, 1.00, 0.20);
  577. glBegin(GL_POLYGON);
  578. glVertex2f(41.269907929601, 13.7567911330596);
  579. glVertex2f(41.269907929601, 16.2087804553787);
  580. glVertex2f(43.7218972519201, 16.2087804553787);
  581. glVertex2f(43.7218972519201, 13.7567911330596);
  582. glEnd();
  583. glFlush();
  584.  
  585. //jendela 2
  586. glColor3f(1.00, 1.00, 0.20);
  587. glBegin(GL_POLYGON);
  588. glVertex2f(41.2614345370283, 19.6572880802316);
  589. glVertex2f(41.2614345370283, 22.1092774025507);
  590. glVertex2f(43.7134238593474, 22.1092774025507);
  591. glVertex2f(43.7134238593474, 19.6572880802316);
  592. glEnd();
  593. glFlush();
  594.  
  595. //jendela 3
  596. glColor3f(1.00, 1.00, 0.20);
  597. glBegin(GL_POLYGON);
  598. glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695);
  599. glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695);
  600. glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695);
  601. glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695);
  602. glEnd();
  603. glFlush();
  604.  
  605. //jendela 4
  606. glColor3f(1.00, 1.00, 0.20);
  607. glBegin(GL_POLYGON);
  608. glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695);
  609. glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695);
  610. glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695);
  611. glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695);
  612. glEnd();
  613. glFlush();
  614.  
  615. //jendela 5
  616. glColor3f(1.00, 1.00, 0.20);
  617. glBegin(GL_POLYGON);
  618. glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695);
  619. glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695);
  620. glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695);
  621. glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695);
  622. glEnd();
  623. glFlush();
  624.  
  625. //jendela 6
  626. glColor3f(1.00, 1.00, 0.20);
  627. glBegin(GL_POLYGON);
  628. glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  629. glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  630. glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  631. glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  632. glEnd();
  633. glFlush();
  634.  
  635. //jendela 7
  636. glColor3f(1.00, 1.00, 0.20);
  637. glBegin(GL_POLYGON);
  638. glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  639. glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  640. glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  641. glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  642. glEnd();
  643. glFlush();
  644.  
  645. //jendela 8
  646. glColor3f(1.00, 1.00, 0.20);
  647. glBegin(GL_POLYGON);
  648. glVertex2f(41.2614345370283, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  649. glVertex2f(41.2614345370283, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  650. glVertex2f(43.7134238593474, 22.1092774025507 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  651. glVertex2f(43.7134238593474, 19.6572880802316 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  652. glEnd();
  653. glFlush();
  654.  
  655. //jendela9
  656. glColor3f(1.00, 1.00, 0.20);
  657. glBegin(GL_POLYGON);
  658. glVertex2f(54.7960899456286, 13.8045959867067);
  659. glVertex2f(54.7960899456286, 16.2565853090258);
  660. glVertex2f(57.2480792679477, 16.2565853090258);
  661. glVertex2f(57.2480792679477, 13.8045959867067);
  662. glEnd();
  663. glFlush();
  664.  
  665. //jendela10
  666. glColor3f(1.00, 1.00, 0.20);
  667. glBegin(GL_POLYGON);
  668. glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695);
  669. glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695);
  670. glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695);
  671. glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695);
  672. glEnd();
  673. glFlush();
  674.  
  675. //jendela11
  676. glColor3f(1.00, 1.00, 0.20);
  677. glBegin(GL_POLYGON);
  678. glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695);
  679. glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695);
  680. glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695);
  681. glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695);
  682. glEnd();
  683. glFlush();
  684.  
  685. //jendela12
  686. glColor3f(1.00, 1.00, 0.20);
  687. glBegin(GL_POLYGON);
  688. glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695);
  689. glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695);
  690. glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695);
  691. glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695);
  692. glEnd();
  693. glFlush();
  694.  
  695. //jendela13
  696. glColor3f(1.00, 1.00, 0.20);
  697. glBegin(GL_POLYGON);
  698. glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  699. glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  700. glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  701. glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  702. glEnd();
  703. glFlush();
  704.  
  705. //jendela14
  706. glColor3f(1.00, 1.00, 0.20);
  707. glBegin(GL_POLYGON);
  708. glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  709. glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  710. glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  711. glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  712. glEnd();
  713. glFlush();
  714.  
  715. //jendela15
  716. glColor3f(1.00, 1.00, 0.20);
  717. glBegin(GL_POLYGON);
  718. glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  719. glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  720. glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  721. glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  722. glEnd();
  723. glFlush();
  724.  
  725. //jendela16
  726. glColor3f(1.00, 1.00, 0.20);
  727. glBegin(GL_POLYGON);
  728. glVertex2f(54.7960899456286, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  729. glVertex2f(54.7960899456286, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  730. glVertex2f(57.2480792679477, 16.2565853090258 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  731. glVertex2f(57.2480792679477, 13.8045959867067 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695 + 5.90049695);
  732. glEnd();
  733. glFlush();
  734.  
  735. //jendela besar 1
  736. glColor3f(1.00, 1.00, 0.20);
  737. glBegin(GL_POLYGON);
  738. glVertex2f(47.0968939348456, 55.0646605762769);
  739. glVertex2f(47.0968939348456, 57.516649898596);
  740. glVertex2f(51.7488832571647, 57.516649898596);
  741. glVertex2f(51.7488832571647, 55.0646605762769);
  742. glEnd();
  743. glFlush();
  744.  
  745. //jendela besar 2
  746. glColor3f(1.00, 1.00, 0.20);
  747. glBegin(GL_POLYGON);
  748. glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695);
  749. glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695);
  750. glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695);
  751. glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695);
  752. glEnd();
  753. glFlush();
  754.  
  755. //jendela besar 3
  756. glColor3f(1.00, 1.00, 0.20);
  757. glBegin(GL_POLYGON);
  758. glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695);
  759. glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695);
  760. glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695);
  761. glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695);
  762. glEnd();
  763. glFlush();
  764.  
  765. //jendela besar 4
  766. glColor3f(1.00, 1.00, 0.20);
  767. glBegin(GL_POLYGON);
  768. glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695);
  769. glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695);
  770. glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695);
  771. glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695);
  772. glEnd();
  773. glFlush();
  774.  
  775. //jendela besar 5
  776. glColor3f(1.00, 1.00, 0.20);
  777. glBegin(GL_POLYGON);
  778. glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  779. glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  780. glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  781. glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  782. glEnd();
  783. glFlush();
  784.  
  785. //jendela besar 6
  786. glColor3f(1.00, 1.00, 0.20);
  787. glBegin(GL_POLYGON);
  788. glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  789. glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  790. glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  791. glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  792. glEnd();
  793. glFlush();
  794.  
  795. //jendela besar 7
  796. glColor3f(1.00, 1.00, 0.20);
  797. glBegin(GL_POLYGON);
  798. glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  799. glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  800. glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  801. glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  802. glEnd();
  803. glFlush();
  804.  
  805. //jendela besar 8
  806. glColor3f(1.00, 1.00, 0.20);
  807. glBegin(GL_POLYGON);
  808. glVertex2f(47.0968939348456, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  809. glVertex2f(47.0968939348456, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  810. glVertex2f(51.7488832571647, 57.516649898596 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  811. glVertex2f(51.7488832571647, 55.0646605762769 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695 - 5.90049695);
  812. glEnd();
  813. glFlush();
  814.  
  815. //pintu
  816. glColor3f(0.00, 0.00, 0.00);
  817. glBegin(GL_POLYGON);
  818. glVertex2f(46.9280382963844, 3.9841111539729);
  819. glVertex2f(46.9280382963844, 9.336100476292);
  820. glVertex2f(51.5800276187035, 9.336100476292);
  821. glVertex2f(51.5800276187035, 3.9841111539729);
  822. glEnd();
  823. glFlush();
  824.  
  825.  
  826.  
  827.  
  828.  
  829. /////// GEDUNG KECIL//////
  830.  
  831. //gedung kecil 1
  832. glColor3f(0.70, 0.75, 0.71);
  833. glBegin(GL_POLYGON);
  834. glVertex2f(15.2, 4);
  835. glVertex2f(15.2, 32);
  836. glVertex2f(37.8, 32);
  837. glVertex2f(37.8, 4);
  838. glEnd();
  839. glFlush();
  840.  
  841. //jendela 1
  842. glColor3f(0.0, 0.0, 0.0);
  843. glBegin(GL_POLYGON);
  844. glVertex2f(18.1533263322379, 25.6619394489688);
  845. glVertex2f(18.1465447981508, 28.0111331988837);
  846. glVertex2f(20.7160831503269, 28.0111331988837);
  847. glVertex2f(20.7160831503269, 25.6619394489688);
  848. glEnd();
  849. glFlush();
  850.  
  851. //jendela 2
  852. glColor3f(0.0, 0.0, 0.0);
  853. glBegin(GL_POLYGON);
  854. glVertex2f(18.2730245855641, 19.6083196536063);
  855. glVertex2f(20.7250139078832, 19.6083196536063);
  856. glVertex2f(20.7250139078832, 22.0603089759254);
  857. glVertex2f(18.2730245855641, 22.0603089759254);
  858. glEnd();
  859. glFlush();
  860.  
  861. //jendela 3
  862. glColor3f(1.00, 1.00, 0.20);
  863. glBegin(GL_POLYGON);
  864. glVertex2f(18.2723039594753, 13.7482168358247);
  865. glVertex2f(18.2723039594753, 16.2002061581438);
  866. glVertex2f(20.7242932817944, 16.2002061581438);
  867. glVertex2f(20.7242932817944, 13.7482168358247);
  868. glEnd();
  869. glFlush();
  870.  
  871. //jendela 4
  872. glColor3f(1.00, 1.00, 0.20);
  873. glBegin(GL_POLYGON);
  874. glVertex2f(31.9374696626437, 25.3699828721337);
  875. glVertex2f(31.9374696626437, 27.8219721944528);
  876. glVertex2f(34.3894589849628, 27.8219721944528);
  877. glVertex2f(34.3894589849628, 25.3699828721337);
  878. glEnd();
  879. glFlush();
  880.  
  881. //jendela 5
  882. glColor3f(1.00, 1.00, 0.20);
  883. glBegin(GL_POLYGON);
  884. glVertex2f(31.9701621292047, 19.6161087574081);
  885. glVertex2f(31.9701621292047, 22.0680980797272);
  886. glVertex2f(34.4221514515238, 22.0680980797272);
  887. glVertex2f(34.4221514515238, 19.6161087574081);
  888. glEnd();
  889. glFlush();
  890.  
  891. //jendela 6
  892. glColor3f(1.00, 1.00, 0.20);
  893. glBegin(GL_POLYGON);
  894. glVertex2f(32.0355470623266, 13.8295421761215);
  895. glVertex2f(32.0355470623266, 16.2815314984406);
  896. glVertex2f(34.4875363846457, 16.2815314984406);
  897. glVertex2f(34.4875363846457, 13.8295421761215);
  898. glEnd();
  899. glFlush();
  900.  
  901. //jendela besar rumah1 1
  902. glColor3f(0.00, 0.00, 0.00);
  903. glBegin(GL_POLYGON);
  904. glVertex2f(24.1166690442812, 25.5255028566319);
  905. glVertex2f(24.1166690442812, 27.977492178951);
  906. glVertex2f(28.7686583666003, 27.977492178951);
  907. glVertex2f(28.7686583666003, 25.5255028566319);
  908. glEnd();
  909. glFlush();
  910.  
  911. //jendela besar rumah1 2
  912. glColor3f(0.00, 0.00, 0.00);
  913. glBegin(GL_POLYGON);
  914. glVertex2f(24.1372191772075, 19.6575413746567);
  915. glVertex2f(24.1372191772075, 22.1095306969758);
  916. glVertex2f(28.7892084995266, 22.1095306969758);
  917. glVertex2f(28.7892084995266, 19.6575413746567);
  918. glEnd();
  919. glFlush();
  920.  
  921. //jendela besar rumah1 3
  922. glColor3f(0.00, 0.00, 0.00);
  923. glBegin(GL_POLYGON);
  924. glVertex2f(24.1694254028489, 13.7936993468023);
  925. glVertex2f(24.1694254028489, 16.2456886691214);
  926. glVertex2f(28.821414725168, 16.2456886691214);
  927. glVertex2f(28.821414725168, 13.7936993468023);
  928. glEnd();
  929. glFlush();
  930.  
  931. //pintu rumah1
  932. glColor3f(0.00, 0.00, 0.00);
  933. glBegin(GL_POLYGON);
  934. glVertex2f(23.9932204416424, 4.019791369435);
  935. glVertex2f(23.9932204416424, 9.3717806917541);
  936. glVertex2f(28.6452097639615, 9.3717806917541);
  937. glVertex2f(28.6452097639615, 4.019791369435);
  938. glEnd();
  939. glFlush();
  940.  
  941. ////------------gedung 2--------------/////
  942. glColor3f(0.70, 0.75, 0.71);
  943. glBegin(GL_POLYGON);
  944. glVertex2f(63.177182086235, 4.0498582903215);
  945. glVertex2f(63.177182086235, 32.1498582903215);
  946. glVertex2f(85.777182086235, 32.1498582903215);
  947. glVertex2f(85.777182086235, 4.0498582903215);
  948. glEnd();
  949. glFlush();
  950.  
  951. //jendela 1
  952. glColor3f(0.00, 0.00, 0.00);
  953. glBegin(GL_POLYGON);
  954. glVertex2f(66.4280728630853, 25.6420228971954);
  955. glVertex2f(66.4280728630853, 28.0940122195145);
  956. glVertex2f(68.8800621854044, 28.0940122195145);
  957. glVertex2f(68.8800621854044, 25.6420228971954);
  958. glEnd();
  959. glFlush();
  960.  
  961. //jendela 2
  962. glColor3f(1.00, 1.00, 0.20);
  963. glBegin(GL_POLYGON);
  964. glVertex2f(66.3537713360208, 19.6979007320387);
  965. glVertex2f(66.3537713360208, 22.1498900543578);
  966. glVertex2f(68.8057606583399, 22.1498900543578);
  967. glVertex2f(68.8057606583399, 19.6979007320387);
  968. glEnd();
  969. glFlush();
  970.  
  971. //jendela 2
  972. glColor3f(1.00, 1.00, 0.20);
  973. glBegin(GL_POLYGON);
  974. glVertex2f(66.3537713360208, 19.6979007320387);
  975. glVertex2f(66.3537713360208, 22.1498900543578);
  976. glVertex2f(68.8057606583399, 22.1498900543578);
  977. glVertex2f(68.8057606583399, 19.6979007320387);
  978. glEnd();
  979. glFlush();
  980.  
  981. //jendela 3
  982. glColor3f(1.00, 1.00, 0.20);
  983. glBegin(GL_POLYGON);
  984. glVertex2f(66.5766759172142, 13.9023816210109);
  985. glVertex2f(66.5766759172142, 16.35437094333);
  986. glVertex2f(69.0286652395333, 16.35437094333);
  987. glVertex2f(69.0286652395333, 13.9023816210109);
  988. glEnd();
  989. glFlush();
  990.  
  991. //jendela 4
  992. glColor3f(1.00, 1.00, 0.20);
  993. glBegin(GL_POLYGON);
  994. glVertex2f(80.2481568970748, 25.6420228971954);
  995. glVertex2f(80.2481568970748, 28.0940122195145);
  996. glVertex2f(82.7001462193939, 28.0940122195145);
  997. glVertex2f(82.7001462193939, 25.6420228971954);
  998. glEnd();
  999. glFlush();
  1000.  
  1001. //jendela 5
  1002. glColor3f(1.00, 1.00, 0.20);
  1003. glBegin(GL_POLYGON);
  1004. glVertex2f(80.2123788293953, 19.7338985689341);
  1005. glVertex2f(80.2123788293953, 22.1858878912532);
  1006. glVertex2f(82.6643681517145, 22.1858878912532);
  1007. glVertex2f(82.6643681517145, 19.7338985689341);
  1008. glEnd();
  1009. glFlush();
  1010.  
  1011. //jendela 6
  1012. glColor3f(0.00, 0.00, 0.00);
  1013. glBegin(GL_POLYGON);
  1014. glVertex2f(80.2850123226567, 14.032169347923);
  1015. glVertex2f(80.2850123226567, 16.4841586702421);
  1016. glVertex2f(82.7370016449758, 16.4841586702421);
  1017. glVertex2f(82.7370016449758, 14.032169347923);
  1018. glEnd();
  1019. glFlush();
  1020.  
  1021. //jendela besar 1
  1022. glColor3f(1.00, 1.00, 0.20);
  1023. glBegin(GL_POLYGON);
  1024. glVertex2f(72.1664885100119, 25.5170060689998);
  1025. glVertex2f(72.1664885100119, 27.9689953913189);
  1026. glVertex2f(76.818477832331, 27.9689953913189);
  1027. glVertex2f(76.818477832331, 25.5170060689998);
  1028. glEnd();
  1029. glFlush();
  1030.  
  1031. //jendela besar 2
  1032. glColor3f(1.00, 1.00, 0.20);
  1033. glBegin(GL_POLYGON);
  1034. glVertex2f(72.1186550669397, 19.6986161578653);
  1035. glVertex2f(72.1186550669397, 22.1506054801844);
  1036. glVertex2f(76.7706443892588, 22.1506054801844);
  1037. glVertex2f(76.7706443892588, 19.6986161578653);
  1038. glEnd();
  1039. glFlush();
  1040.  
  1041. //jendela besar 3
  1042. glColor3f(1.00, 1.00, 0.20);
  1043. glBegin(GL_POLYGON);
  1044. glVertex2f(72.1567930427048, 13.8635058658061);
  1045. glVertex2f(72.1567930427048, 16.3154951881252);
  1046. glVertex2f(76.8087823650239, 16.3154951881252);
  1047. glVertex2f(76.8087823650239, 13.8635058658061);
  1048. glEnd();
  1049. glFlush();
  1050.  
  1051. //pintu
  1052. glColor3f(0.00, 0.00, 0.00);
  1053. glBegin(GL_POLYGON);
  1054. glVertex2f(72.0720115699144, 4.0426982071601);
  1055. glVertex2f(72.0720115699144, 9.4946875294792);
  1056. glVertex2f(76.7240008922335, 9.4946875294792);
  1057. glVertex2f(76.7240008922335, 4.0426982071601);
  1058. glEnd();
  1059. glFlush();
  1060.  
  1061.  
  1062.  
  1063. //tanah
  1064. glColor3f(0.33, 0.33, 0.33);
  1065. glBegin(GL_POLYGON);
  1066. glVertex2f(-30, -30);
  1067. glVertex2f(-30, 4);
  1068. glVertex2f(100, 4);
  1069. glVertex2f(100, -30);
  1070. glEnd();
  1071. glFlush();
  1072.  
  1073. //////////////BINTANG1 START////////////////////////////
  1074.  
  1075.  
  1076. static float tick = 00; //tick, variabel yang akan kita tambahkan terus tiap frame
  1077.  
  1078. float inc = 1.00; //variabel pengatur kecepatan, ubah sesuai porsi;
  1079.  
  1080. point2D_t ef[11] = { {-18.4290478706305,-16.5316371780857},{-16.512076561712,-16.5370386389846},{-15.868481167077,-14.7197107395542},{-15.239189350102,-16.5533368959124},{-13.2970646046101,-16.5424870369991},{-14.8160448524808,-17.7142717996422},{-14.2952516246394,-19.5153483792603},{-15.8793310259903,-18.4520622057508},{-17.4959600040813,-19.5478979560004},{-16.9317673405865,-17.7142717996422},{-18.4290478706305,-16.5316371780857} }; //bentuk kotak
  1081.  
  1082. matrix2D_t mat; //variabel temporary yang digunakan untuk menggerakkan
  1083. vector2D_t vec[11];
  1084. setColor(1, 1, 1);
  1085.  
  1086. //arahx, arahy ditambah tick supaya gerak, kalau gak tambah bakal diam
  1087. float arahx = 1.00 + tick; //0.01 itu kecepatannya
  1088. float arahy = 110.00 - tick;
  1089.  
  1090. mat = translationMTX(arahx, arahy); //membentuk matrixnya,
  1091.  
  1092. //mengalikan matrix dengan titik asal untuk mengubah posisi
  1093. for (int i = 0; i < 11; i++) {
  1094. vec[i] = Point2Vector(ef[i]);
  1095. vec[i] = multiply(mat, vec[i]);
  1096. ef[i] = Vector2Point(vec[i]);
  1097. }
  1098. //digambar deh
  1099. drawPolyline(ef, 11);
  1100. //increment tick, biarkan tambah terus
  1101. tick += inc;
  1102.  
  1103.  
  1104. //////////////BINTANG1 END////////////////////////////
  1105. static float tick2 = 00;
  1106. float inc2 = 1.00;
  1107. point2D_t ef2[11] = { {-18.4290478706305,-16.5316371780857},{-16.512076561712,-16.5370386389846},{-15.868481167077,-14.7197107395542},{-15.239189350102,-16.5533368959124},{-13.2970646046101,-16.5424870369991},{-14.8160448524808,-17.7142717996422},{-14.2952516246394,-19.5153483792603},{-15.8793310259903,-18.4520622057508},{-17.4959600040813,-19.5478979560004},{-16.9317673405865,-17.7142717996422},{-18.4290478706305,-16.5316371780857} }; //bentuk kotak
  1108. matrix2D_t mat2; //variabel temporary yang digunakan untuk menggerakkan
  1109. vector2D_t vec2[11];
  1110. setColor(1, 1, 1);
  1111. float arahx2 = 1.00 - tick2; //0.01 itu kecepatannya
  1112. float arahy2 = 1.00 - tick2;
  1113. mat2 = translationMTX(arahx2, arahy2); //membentuk matrixnya,
  1114.  
  1115. for (int i = 0; i < 11; i++) {
  1116. vec2[i] = Point2Vector(ef2[i]);
  1117. vec2[i] = multiply(mat2, vec2[i]);
  1118. ef2[i] = Vector2Point(vec2[i]);
  1119. }
  1120. drawPolyline(ef2, 11);
  1121. tick2 -= inc2;
  1122.  
  1123.  
  1124. //perintah animasi
  1125. glPushMatrix();
  1126. glTranslatef(gerak, 0, 0);
  1127.  
  1128.  
  1129. glColor3f(255.0, 255.0, 0.0);
  1130. glBegin(GL_POLYGON);
  1131.  
  1132. radius = 400;
  1133. jumlah_titik = 300;
  1134. x_tengah = 100;
  1135. y_tengah = 8000;
  1136.  
  1137. for (i = 0; i <= 360; i++)
  1138. {
  1139. float sudut = i * (2 * PI / jumlah_titik);
  1140. float x = x_tengah + radius * cos(sudut);
  1141. float y = y_tengah + radius * sin(sudut);
  1142. glVertex2f(x / 100, y / 100);
  1143. }
  1144.  
  1145. glEnd();
  1146. glFlush();
  1147.  
  1148. glPopMatrix();
  1149.  
  1150.  
  1151. }
  1152. void timer(int t)
  1153. {
  1154.  
  1155. gerak += 1;
  1156.  
  1157.  
  1158. glutPostRedisplay();
  1159. glutTimerFunc(130, timer, 0);
  1160. }
  1161.  
  1162. void timeer(int value)
  1163. {
  1164. glutTimerFunc(9999999, timeer, 0);
  1165. glutPostRedisplay();
  1166. }
  1167.  
  1168. void display() {
  1169. glClear(GL_COLOR_BUFFER_BIT);
  1170. tampil();
  1171. glFlush();
  1172. glutSwapBuffers();
  1173. }
  1174.  
  1175. int main(int argc, char** argv)
  1176. {
  1177.  
  1178. glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
  1179. glutInitWindowSize(600, 600);
  1180. glutCreateWindow("Bulan");
  1181. glutPostRedisplay();
  1182. glutDisplayFunc(display);
  1183. gluOrtho2D(-20., 100., -20.0, 100.0);
  1184. // glutTimerFunc(0, timeer, 0);
  1185. glutTimerFunc(0, timer, 0);
  1186. glutMainLoop();
  1187.  
  1188. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement