Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.74 KB | None | 0 0
  1. #include <windows.h>
  2. #include <GL/gl.h>
  3. #include <GL/glu.h>
  4. #include <GL/glut.h>
  5. #include <stdlib.h>
  6.  
  7. static int slices = 25;
  8. static int stacks = 25;
  9. float ratio;
  10. float yCord = -2.5;
  11. float zCord = -60.0;
  12. float RotateX = -30.0f;
  13. float RotationSpeedX = 0.0f;
  14. float RotateY = 30.0f;
  15. float RotationSpeedY = 0.0f;
  16. float KecRot = 0.0f;
  17. float KecRot2 = 0.0f;
  18. float LightZ = 26.0f;
  19. float LightX = 0.0f;
  20. float LightY = 15.0f;
  21.  
  22. GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
  23. GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
  24. GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
  25. GLfloat light_position[] = { LightX, LightY, LightZ, 0.0f };
  26. GLfloat mat_ambient[] = { 0.7f, 0.7f, 0.7f, 1.0f };
  27. GLfloat mat_diffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f };
  28. GLfloat mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
  29. GLfloat high_shininess[] = { 100.0f };
  30.  
  31. static void resize(int width, int height) {
  32. const float ar = (float)width / (float)height;
  33. glViewport(0, 0, width, height);
  34. glMatrixMode(GL_PROJECTION);
  35. glLoadIdentity();
  36. glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);
  37. glMatrixMode(GL_MODELVIEW);
  38. glLoadIdentity();
  39. }
  40.  
  41. void keyboard(unsigned char key, int x, int y) {
  42. switch (key) {
  43. case 27:
  44. exit(0);
  45. break;
  46. glutPostRedisplay();
  47. }
  48. }
  49.  
  50. void specialkeys(int key, int x, int y) {
  51. switch (key) {
  52. case GLUT_KEY_LEFT:
  53. RotationSpeedX += 0.07;
  54. if (RotationSpeedX >= 1.0)
  55. RotationSpeedX = 1.0;
  56. break;
  57. case GLUT_KEY_RIGHT:
  58. RotationSpeedX -= 0.07;
  59. if (RotationSpeedX <= -1.0)
  60. RotationSpeedX = -1.0;
  61. break;
  62. case GLUT_KEY_UP:
  63. zCord += 0.2;
  64. if (zCord >= -10.0)
  65. zCord = -10.0;
  66. break;
  67. case GLUT_KEY_DOWN:
  68. zCord -= 0.1;
  69. if (zCord <= -60.0)
  70. zCord = -60.0;
  71. break;
  72. case GLUT_KEY_END:
  73. RotationSpeedY -= 0.07;
  74. if (RotationSpeedY <= -1.0)
  75. RotationSpeedY = -1.0;
  76. break;
  77. case GLUT_KEY_HOME:
  78. RotationSpeedY += 0.07;
  79. if (RotationSpeedY >= 1.0)
  80. RotationSpeedY = 1.0;
  81. break;
  82. case GLUT_KEY_PAGE_DOWN:
  83. yCord += 0.1f;
  84. if (yCord >= 15.0)
  85. yCord = 15.0;
  86. break;
  87. case GLUT_KEY_PAGE_UP:
  88. yCord -= 0.1;
  89. if (yCord <= -15.0)
  90. yCord = -15.0;
  91. break;
  92. default:
  93. break;
  94. }
  95. glutPostRedisplay();
  96. }
  97.  
  98. void sumbu(void) {
  99. glColor3f(1.0, 0.0, 0.0);
  100. glBegin(GL_LINES);
  101. glVertex3f(-30.0, 0.0, 0.0);
  102. glVertex3f(30.0, 0.0, 0.0);
  103. glEnd();
  104.  
  105. glColor3f(0.0, 1.0, 0.0);
  106. glBegin(GL_LINES);
  107. glVertex3f(0.0, 10, 0.0);
  108. glVertex3f(0.0, -10.0, 0.0);
  109. glEnd();
  110.  
  111. glColor3f(0.0, 0.0, 1.0);
  112. glBegin(GL_LINES);
  113. glVertex3f(0.0, 0.0, -30.0);
  114. glVertex3f(0.0, 0.0, 30.0);
  115. glEnd();
  116. }
  117.  
  118. static void display(void) {
  119. gluLookAt(1.0, 10.0, 15.0, 0.0, 0.0, 5.0, 0.0, 10.0, 0.0);
  120. const double t = glutGet(GLUT_ELAPSED_TIME) / 10000.0;
  121. const double t2 = glutGet(GLUT_ELAPSED_TIME) / 20.0;
  122. const double a = t * 90.0, b = t / 2, c = t / 10, d = t2 * 90;
  123. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  124. glLoadIdentity();
  125. glTranslatef(0.0, yCord, zCord);
  126. glTranslatef(0.0, yCord, 0.0);
  127. glRotatef(RotateX, 0, 1.0, 0);
  128. glRotatef(RotateY, 1.0, 0, 0);
  129. RotateX += RotationSpeedX;
  130. RotateY += RotationSpeedY;
  131. glPushMatrix();
  132. sumbu();
  133. glPopMatrix();
  134.  
  135. ////////////////////////////////////////LANTAI Kemas Risman Fauzan - 10116313
  136. //Pondasi lantai
  137. glPushMatrix();
  138. glTranslated(0.0, 0.1, 0.0);
  139. glScaled(60.0, 0.5, 30.0);
  140. glColor3d(0.0, 0.0, 0.0);
  141. glutSolidCube(1);
  142. glPopMatrix();
  143.  
  144. //lantai
  145. glPushMatrix();
  146. glTranslated(0.0, 0.4, 0.0);
  147. glScaled(60.0, 0.1, 30.0);
  148. glColor3d(1.0, 1.0, 1.0);
  149. glutSolidCube(1);
  150. glPopMatrix();
  151.  
  152. ///////////////////////////////////////TEMBOK - KEMAS RISMAN 10116313
  153. //tembok 1 sumbu z
  154. glPushMatrix();
  155. glTranslated(-29.5, 7.5, 4.5);
  156. glScaled(1.0, 14.0, 21.0);
  157. glColor3d(1.0, 1.0, 1.0);
  158. glutSolidCube(1);
  159. glPopMatrix();
  160.  
  161. //tembok 2 sumbu x
  162. glPushMatrix();
  163. glTranslated(-27.0, 7.5, -5.5);
  164. glScaled(5.0, 14.0, 1.0);
  165. glColor3d(1.0, 1.0, 1.0);
  166. glutSolidCube(1);
  167. glPopMatrix();
  168.  
  169. //tembok 3 sumbu z
  170. glPushMatrix();
  171. glTranslated(-25.0, 7.5, -6.5);
  172. glScaled(1.0, 14.0, 2.0);
  173. glColor3d(1.0, 1.0, 1.0);
  174. glutSolidCube(1);
  175. glPopMatrix();
  176.  
  177. //tembok 4 sumbu z atas
  178. glPushMatrix();
  179. glTranslated(-25.0, 13.0, -10.5);
  180. glScaled(1.0, 3.0, 6.0);
  181. glColor3d(1.0, 1.0, 1.0);
  182. glutSolidCube(1);
  183. glPopMatrix();
  184.  
  185. //tembok 5 sumbu z
  186. glPushMatrix();
  187. glTranslated(-25.0, 7.5, -14.0);
  188. glScaled(1.0, 14.0, 2.0);
  189. glColor3d(1.0, 1.0, 1.0);
  190. glutSolidCube(1);
  191. glPopMatrix();
  192.  
  193. //tembok 6 sumbu x
  194. glPushMatrix();
  195. glTranslated(2.5, 7.5, -14.5);
  196. glScaled(55.0, 14.0, 1.0);
  197. glColor3d(1.0, 1.0, 1.0);
  198. glutSolidCube(1);
  199. glPopMatrix();
  200.  
  201. //tembok 7 sumbu z
  202. glPushMatrix();
  203. glTranslated(29.5, 7.5, 0.0);
  204. glScaled(1.0, 14.0, 30.0);
  205. glColor3d(1.0, 1.0, 1.0);
  206. glutSolidCube(1);
  207. glPopMatrix();
  208.  
  209. //tembok 8 sumbu z
  210. glPushMatrix();
  211. glTranslated(10.0, 7.5, -12.0);
  212. glScaled(1.0, 14.0, 6.0);
  213. glColor3d(1.0, 1.0, 1.0);
  214. glutSolidCube(1);
  215. glPopMatrix();
  216.  
  217. //tembok 9 sumbu x
  218. glPushMatrix();
  219. glTranslated(19.5, 3.5, -3.5);
  220. glScaled(20.0, 6.0, 1.0);
  221. glColor3d(1.0, 1.0, 1.0);
  222. glutSolidCube(1);
  223. glPopMatrix();
  224.  
  225. //tembok 10 sumbu z
  226. glPushMatrix();
  227. glTranslated(10.0, 3.5, 3.5);
  228. glScaled(1.0, 6.0, 13.0);
  229. glColor3d(1.0, 1.0, 1.0);
  230. glutSolidCube(1);
  231. glPopMatrix();
  232.  
  233. ///////////////////////////////////////PINTU - HEDDY CAHYA FIRDAUS 10116309
  234. /// Pintu Pertama
  235. //bingkai pintu utama 1
  236. glPushMatrix();
  237. glTranslated(-25.0, 6.0, -7.6);
  238. glScaled(1.0, 11.0, 0.2);
  239. glColor3d(0.0, 0.0, 0.0);
  240. glutSolidCube(1);
  241. glPopMatrix();
  242.  
  243. //bingkai pintu utama 2
  244. glPushMatrix();
  245. glTranslated(-25.0, 11.4, -10.3);
  246. glScaled(1.0, 0.2, 5.4);
  247. glColor3d(0.0, 0.0, 0.0);
  248. glutSolidCube(1);
  249. glPopMatrix();
  250.  
  251. //bingkai pintu utama 3
  252. glPushMatrix();
  253. glTranslated(-25.0, 6.0, -12.9);
  254. glScaled(1.0, 11.0, 0.2);
  255. glColor3d(0.0, 0.0, 0.0);
  256. glutSolidCube(1);
  257. glPopMatrix();
  258.  
  259. //pintu utama
  260. glPushMatrix();
  261. glTranslated(-22.5, 5.8, -9.0);
  262. glRotated(-70, 0, 50, 0);
  263. glScaled(1.0, 11.0, 5.3);
  264. glColor3d(1.0, 0.4, 0.0);
  265. glutSolidCube(1);
  266. glPopMatrix();
  267.  
  268. //teskstur pintu utama 1
  269. glPushMatrix();
  270. glTranslated(-22.5, 8.3, -9.0);
  271. glRotated(-70, 0, 50, 0);
  272. glScaled(1.3, 4.5, 4.0);
  273. glColor3d(1.0, 0.5, 0.0);
  274. glutSolidCube(1);
  275. glPopMatrix();
  276.  
  277. //teskstur pintu utama 2
  278. glPushMatrix();
  279. glTranslated(-22.5, 3.3, -9.0);
  280. glRotated(-70, 0, 50, 0);
  281. glScaled(1.3, 4.5, 4.0);
  282. glColor3d(1.0, 0.5, 0.0);
  283. glutSolidCube(1);
  284. glPopMatrix();
  285.  
  286. //gagang pintu utama 1
  287. glPushMatrix();
  288. glTranslated(-20.7, 5.8, -10.5);
  289. glScaled(0.3, 0.3, 0.3);
  290. glColor3d(0.2, 0.2, 0.2);
  291. glutSolidSphere(1, slices, stacks);
  292. glPopMatrix();
  293.  
  294. //gagang pintu utama 2
  295. glPushMatrix();
  296. glTranslated(-20.0, 5.8, -9.0);
  297. glScaled(0.3, 0.3, 0.3);
  298. glColor3d(0.2, 0.2, 0.2);
  299. glutSolidSphere(1, slices, stacks);
  300. glPopMatrix();
  301.  
  302. /// Pintu Kedua
  303. //pintu utama
  304. glPushMatrix();
  305. glTranslated(12.0, 5.8, -9.0);
  306. glRotated(-70, 0, 50, 0);
  307. glScaled(1.0, 11.0, 5.3);
  308. glColor3d(0,0,128);
  309. glutSolidCube(1);
  310. glPopMatrix();
  311.  
  312. //teskstur pintu utama 1
  313. glPushMatrix();
  314. glTranslated(12.0, 8.3, -9.0);
  315. glRotated(-70, 0, 50, 0);
  316. glScaled(1.3, 4.5, 4.0);
  317. glColor3d(255,255,255);
  318. glutSolidCube(1);
  319. glPopMatrix();
  320.  
  321. //teskstur pintu utama 2
  322. glPushMatrix();
  323. glTranslated(12.0, 3.3, -9.0);
  324. glRotated(-70, 0, 50, 0);
  325. glScaled(1.3, 4.5, 4.0);
  326. glColor3d(255,255,255);
  327. glutSolidCube(1);
  328. glPopMatrix();
  329.  
  330. //gagang pintu utama 1
  331. glPushMatrix();
  332. glTranslated(14.0, 5.8, -10.5);
  333. glScaled(0.3, 0.3, 0.3);
  334. glColor3d(0.2, 0.2, 0.2);
  335. glutSolidSphere(1, slices, stacks);
  336. glPopMatrix();
  337.  
  338. //gagang pintu utama 2
  339. glPushMatrix();
  340. glTranslated(14.0, 5.8, -9.0);
  341. glScaled(0.3, 0.3, 0.3);
  342. glColor3d(0.2, 0.2, 0.2);
  343. glutSolidSphere(1, slices, stacks);
  344. glPopMatrix();
  345.  
  346.  
  347. ///////////////////////////////////////KESET - HEDDY CAHYA FIRDAUS 10116309
  348. //Keset Pintu Sebelah Kiri
  349. glPushMatrix();
  350. glTranslated(-23.0, 0.5, -11.5);
  351. glScaled(2.5, 0.1, 3.0);
  352. glColor3d(0.0, 0.0, 0.0);
  353. glutSolidCube(1);
  354. glPopMatrix();
  355.  
  356. //Keset Kamar Mandi
  357. glPushMatrix();
  358. glTranslated(11.0, 0.5, -6.5);
  359. glScaled(2.5, 0.1, 3.0);
  360. glColor3d(15.0, 15.0, 0.0);
  361. glutSolidCube(1);
  362. glPopMatrix();
  363.  
  364.  
  365. ///////////////////////////////////////MESIN CUCI - ASEP TONI 10116308
  366. //Mesin Cuci
  367. glPushMatrix();
  368. glTranslated(-27.0, 3.5, 13.0);
  369. glScaled(4.0, 6.0, 4.0);
  370. glColor3d(0.686, 0.933, 0.93);
  371. glutSolidCube(1);
  372. glPopMatrix();
  373.  
  374. //bulat mesin cuci
  375. glPushMatrix();
  376. glTranslated(-24.9, 3.5, 13.0);
  377. glScaled(0.0, 2.0, 2.0);
  378. glColor3d(1, 1, 1);
  379. glutSolidSphere(1,slices,stacks);
  380. glPopMatrix();
  381.  
  382. //bulat mesin cuci
  383. glPushMatrix();
  384. glTranslated(-25.5, 2.5, 13.0);
  385. glScaled(0.2, 0.2, 0.2);
  386. glColor3d(0.0, 0.0, 0.0);
  387. glutSolidSphere(1,slices,stacks);
  388. glPopMatrix();
  389.  
  390. //bulat mesin cuci tombol 1
  391. glPushMatrix();
  392. glTranslated(-25.0, 5.5, 11.6);
  393. glScaled(0.2, 0.2, 0.2);
  394. glColor3d(0, 1, 1);
  395. glutSolidSphere(1,slices,stacks);
  396. glPopMatrix();
  397.  
  398. ///////////////////////////////////////DAPUR SET - ASEP TONI 10116308
  399. //kompor
  400. glPushMatrix();
  401. glTranslated(-26.5, 5.5, 6.5);
  402. glScaled(1.5, 0.0, 1.5);
  403. glColor3d(1, 1, 1);
  404. glutSolidSphere(1,slices,stacks);
  405. glPopMatrix();
  406.  
  407. //Dapur Set
  408. glPushMatrix();
  409. glTranslated(-27.0, 2.5, 3.0);
  410. glScaled(4.0, 5.5, 15.5);
  411. glColor3d(0.196, 0.804, 0.196);
  412. glutSolidCube(1);
  413. glPopMatrix();
  414.  
  415. //Dapur Set Pintu 1
  416. glPushMatrix();
  417. glTranslated(-25.3, 2.8, 9.0);
  418. glScaled(1.0, 3.0, 2.5);
  419. glColor3d(0.498, 1.000, 0.000);
  420. glutSolidCube(1);
  421. glPopMatrix();
  422.  
  423. //Dapur Set Pintu Gagang 1
  424. glPushMatrix();
  425. glTranslated(-25.0, 3.8, 9.0);
  426. glScaled(1.0, 0.2, 1.8);
  427. glColor3d(0.000, 0.392, 0.000);
  428. glutSolidCube(1);
  429. glPopMatrix();
  430.  
  431. //Dapur Set Pintu 2
  432. glPushMatrix();
  433. glTranslated(-25.3, 2.8, 6.0);
  434. glScaled(1.0, 3.0, 2.5);
  435. glColor3d(0.498, 1.000, 0.000);
  436. glutSolidCube(1);
  437. glPopMatrix();
  438.  
  439. //Dapur Set Pintu Gagang 2
  440. glPushMatrix();
  441. glTranslated(-25.0, 3.8, 6.0);
  442. glScaled(1.0, 0.2, 1.8);
  443. glColor3d(0.000, 0.392, 0.000);
  444. glutSolidCube(1);
  445. glPopMatrix();
  446.  
  447. //Dapur Set Pintu 3
  448. glPushMatrix();
  449. glTranslated(-25.3, 2.8, 3.0);
  450. glScaled(1.0, 3.0, 2.5);
  451. glColor3d(0.498, 1.000, 0.000);
  452. glutSolidCube(1);
  453. glPopMatrix();
  454.  
  455. //Dapur Set Pintu Gagang 3
  456. glPushMatrix();
  457. glTranslated(-25.0, 3.8, 3.0);
  458. glScaled(1.0, 0.2, 1.8);
  459. glColor3d(0.000, 0.392, 0.000);
  460. glutSolidCube(1);
  461. glPopMatrix();
  462.  
  463. //pintu tinggi
  464. glPushMatrix();
  465. glTranslated(-27.0, 7.5, -1.5);
  466. glScaled(4.0, 5.5, 6.5);
  467. glColor3d(0.196, 0.804, 0.196);
  468. glutSolidCube(1);
  469. glPopMatrix();
  470.  
  471. //Dapur Set Pintu 4
  472. glPushMatrix();
  473. glTranslated(-25.3, 8.0, 0.0);
  474. glScaled(1.0, 3.0, 2.5);
  475. glColor3d(0.498, 1.000, 0.000);
  476. glutSolidCube(1);
  477. glPopMatrix();
  478.  
  479. //Dapur Set Pintu Gagang 4
  480. glPushMatrix();
  481. glTranslated(-25.0, 8.2, -0.8);
  482. glScaled(0.28, 0.28, 0.28);
  483. glColor3d(0.2, 0.2, 0.2);
  484. glutSolidSphere(1, slices, stacks);
  485. glPopMatrix();
  486.  
  487. //Dapur Set Pintu 5
  488. glPushMatrix();
  489. glTranslated(-25.3, 8.0, -3.0);
  490. glScaled(1.0, 3.0, 2.5);
  491. glColor3d(0.498, 1.000, 0.000);
  492. glutSolidCube(1);
  493. glPopMatrix();
  494.  
  495. //Dapur Set Pintu Gagang 5
  496. glPushMatrix();
  497. glTranslated(-25.0, 8.2, -2.2);
  498. glScaled(0.28, 0.28, 0.28);
  499. glColor3d(0.2, 0.2, 0.2);
  500. glutSolidSphere(1, slices, stacks);
  501. glPopMatrix();
  502.  
  503.  
  504. //Dapur Set Pintu 6
  505. glPushMatrix();
  506. glTranslated(-25.3, 3.5, 0.0);
  507. glScaled(1.0, 4.5, 2.5);
  508. glColor3d(0.498, 1.000, 0.000);
  509. glutSolidCube(1);
  510. glPopMatrix();
  511.  
  512. //Dapur Set Pintu Gagang 6
  513. glPushMatrix();
  514. glTranslated(-25.0, 3.8, -0.8);
  515. glScaled(0.28, 0.28, 0.28);
  516. glColor3d(0.2, 0.2, 0.2);
  517. glutSolidSphere(1, slices, stacks);
  518. glPopMatrix();
  519.  
  520. //Dapur Set Pintu 7
  521. glPushMatrix();
  522. glTranslated(-25.3, 3.5, -3.0);
  523. glScaled(1.0, 4.5, 2.5);
  524. glColor3d(0.498, 1.000, 0.000);
  525. glutSolidCube(1);
  526. glPopMatrix();
  527.  
  528. //Dapur Set Pintu Gagang 7
  529. glPushMatrix();
  530. glTranslated(-25.0, 3.8, -2.2);
  531. glScaled(0.28, 0.28, 0.28);
  532. glColor3d(0.2, 0.2, 0.2);
  533. glutSolidSphere(1, slices, stacks);
  534. glPopMatrix();
  535.  
  536.  
  537. ///////////////////////////////////////INTERIOR KAMAR - RIZALU ILMAN 10116304
  538. //Alas Kasur
  539. glPushMatrix();
  540. glTranslated(17.5, 1.0, 3.5);
  541. glScaled(8.3, 1.5, 13.0);
  542. glColor3d(1.0, 0.4, 0.0);
  543. glutSolidCube(1);
  544. glPopMatrix();
  545.  
  546. //Kasur
  547. glPushMatrix();
  548. glTranslated(17.5, 2.5, 3.5);
  549. glScaled(8.0, 1.5, 13.0);
  550. glColor3d(1.0, 1.0, 1.0);
  551. glutSolidCube(1);
  552. glPopMatrix();
  553.  
  554. //Bantal 1
  555. glPushMatrix();
  556. glTranslated(19.5, 3.5, -1.8);
  557. glScaled(2.0, 0.5, 1.3);
  558. glColor3d(0.502, 0.000, 0.000);
  559. glutSolidSphere(1, slices, stacks);
  560. glPopMatrix();
  561.  
  562. //Bantal 2
  563. glPushMatrix();
  564. glTranslated(15.5, 3.5, -1.8);
  565. glScaled(2.0, 0.5, 1.3);
  566. glColor3d(0.502, 0.000, 0.000);
  567. glutSolidSphere(1, slices, stacks);
  568. glPopMatrix();
  569.  
  570. //Guling 1
  571. glPushMatrix();
  572. glTranslated(15.8, 3.5, 3.0);
  573. glScaled(0.5, 0.5, 3.5);
  574. glColor3d(0.502, 0.000, 0.000);
  575. glutSolidSphere(1, slices, stacks);
  576. glPopMatrix();
  577.  
  578. //Guling 2
  579. glPushMatrix();
  580. glTranslated(19.5, 3.5, 3.0);
  581. glScaled(0.5, 0.5, 3.5);
  582. glColor3d(0.502, 0.000, 0.000);
  583. glutSolidSphere(1, slices, stacks);
  584. glPopMatrix();
  585.  
  586. //Selimut
  587. glPushMatrix();
  588. glTranslated(17.5, 3.4, 8.5);
  589. glScaled(8.4, 0.2, 3.0);
  590. glColor3d(0.502, 0.000, 0.000);
  591. glutSolidCube(1);
  592. glPopMatrix();
  593.  
  594. //Selimut sisi 1
  595. glPushMatrix();
  596. glTranslated(13.4, 2.6, 8.5);
  597. glScaled(0.2, 1.7, 3.0);
  598. glColor3d(0.502, 0.000, 0.000);
  599. glutSolidCube(1);
  600. glPopMatrix();
  601.  
  602. //Selimut sisi 2
  603. glPushMatrix();
  604. glTranslated(21.6, 2.6, 8.5);
  605. glScaled(0.2, 1.7, 3.0);
  606. glColor3d(0.502, 0.000, 0.000);
  607. glutSolidCube(1);
  608. glPopMatrix();
  609.  
  610. //Meja Samping Kasur
  611. glPushMatrix();
  612. glTranslated(11.9, 1.5, -2.5);
  613. glScaled(2.9, 3.0, 2.0);
  614. glColor3d(1.0, 0.4, 0.0);
  615. glutSolidCube(1);
  616. glPopMatrix();
  617.  
  618. //Tekstur Meja Samping Kasur 1
  619. glPushMatrix();
  620. glTranslated(11.9, 3.5, -3.0);
  621. glScaled(2.9, 1.0, 0.3);
  622. glColor3d(1.0, 0.4, 0.0);
  623. glutSolidCube(1);
  624. glPopMatrix();
  625.  
  626. //Tekstur Meja Samping Kasur 2
  627. glPushMatrix();
  628. glTranslated(11.9, 3.0, -2.0);
  629. glScaled(2.9, 0.3, 2.3);
  630. glColor3d(1.0, 0.4, 0.0);
  631. glutSolidCube(1);
  632. glPopMatrix();
  633.  
  634. //lampu Dinding 1
  635. glPushMatrix();
  636. glTranslated(11.9, 4.7, -2.7);
  637. glScaled(0.3, 0.3, 0.8);
  638. glColor3d(0.0, 0.0, 0.0);
  639. glutSolidCube(1);
  640. glPopMatrix();
  641.  
  642. //lampu Dinding 2
  643. glPushMatrix();
  644. glTranslated(11.9, 4.7, -2.3);
  645. glScaled(0.4, 1.5, 0.4);
  646. glColor3d(1.0, 1.0, 1.0);
  647. glutSolidCube(1);
  648. glPopMatrix();
  649.  
  650. //Lemari
  651. glPushMatrix();
  652. glTranslated(28.0, 5.5, 2.5);
  653. glScaled(3.5, 10.0, 11.0);
  654. glColor3d(1.0, 0.4, 0.0);
  655. glutSolidCube(1);
  656. glPopMatrix();
  657.  
  658. //Tekstur Lemari 1
  659. glPushMatrix();
  660. glTranslated(26.2, 5.5, -0.1);
  661. glScaled(0.1, 9.0, 4.7);
  662. glColor3d(1.0, 0.5, 0.0);
  663. glutSolidCube(1);
  664. glPopMatrix();
  665.  
  666. //Tekstur Lemari 2
  667. glPushMatrix();
  668. glTranslated(26.2, 5.5, 5.1);
  669. glScaled(0.1, 9.0, 4.7);
  670. glColor3d(1.0, 0.5, 0.0);
  671. glutSolidCube(1);
  672. glPopMatrix();
  673.  
  674. //gagang pintu Lemari 1
  675. glPushMatrix();
  676. glTranslated(26.0, 5.5, 3.2);
  677. glScaled(0.3, 0.3, 0.3);
  678. glColor3d(0.2, 0.2, 0.2);
  679. glutSolidSphere(1, slices, stacks);
  680. glPopMatrix();
  681.  
  682. //gagang pintu Lemari 2
  683. glPushMatrix();
  684. glTranslated(26.0, 5.5, 1.8);
  685. glScaled(0.3, 0.3, 0.3);
  686. glColor3d(0.2, 0.2, 0.2);
  687. glutSolidSphere(1, slices, stacks);
  688. glPopMatrix();
  689.  
  690. //Meja kamar
  691. glPushMatrix();
  692. glTranslated(28.0, 3.3, 11.5);
  693. glScaled(2.0, 0.3, 7.0);
  694. glColor3d(1.0, 0.4, 0.0);
  695. glutSolidCube(1);
  696. glPopMatrix();
  697.  
  698. //Kaki Meja kamar 1
  699. glPushMatrix();
  700. glTranslated(28.0, 2.0, 8.0);
  701. glScaled(2.0, 3.0, 0.3);
  702. glColor3d(1.0, 0.4, 0.0);
  703. glutSolidCube(1);
  704. glPopMatrix();
  705.  
  706. //Kaki Meja kamar 2
  707. glPushMatrix();
  708. glTranslated(28.0, 2.0, 14.9);
  709. glScaled(2.0, 3.0, 0.2);
  710. glColor3d(1.0, 0.4, 0.0);
  711. glutSolidCube(1);
  712. glPopMatrix();
  713.  
  714. //Rak Dinding 1
  715. glPushMatrix();
  716. glTranslated(28.7, 7.0, 10.0);
  717. glScaled(1.5, 0.2, 4.0);
  718. glColor3d(1.0, 0.4, 0.0);
  719. glutSolidCube(1);
  720. glPopMatrix();
  721.  
  722. //Rak Dinding 1
  723. glPushMatrix();
  724. glTranslated(28.7, 6.6, 13.3);
  725. glScaled(1.5, 0.2, 3.0);
  726. glColor3d(1.0, 0.4, 0.0);
  727. glutSolidCube(1);
  728. glPopMatrix();
  729.  
  730. //Karpet
  731. glPushMatrix();
  732. glTranslated(17.5, 0.5, 12.7);
  733. glScaled(8.5, 0.1, 3.5);
  734. glColor3d(0.000, 0.000, 0.502);
  735. glutSolidCube(1);
  736. glPopMatrix();
  737.  
  738. /////////////////////////////////////RUANG TAMU - MUHAMMAD ILHAM 10116297
  739. //alas tv
  740. glPushMatrix();
  741. glTranslated(5.0, 1.0, -12.0);
  742. glScaled(8.0, 1, 6.0);
  743. glColor3d(1.000, 0.980, 0.980);
  744. glutSolidCube(1);
  745. glPopMatrix();
  746.  
  747. //rak samping alas tv
  748. glPushMatrix();
  749. glTranslated(-1.0, 2.0, -12.0);
  750. glScaled(8.0, 1, 6.0);
  751. glColor3d(0.596, 0.984, 0.596);
  752. glutSolidCube(1);
  753. glPopMatrix();
  754.  
  755. //box kiri atas rak samping alas tv
  756. glPushMatrix();
  757. glTranslated(-3.0, 7.0, -12.0);
  758. glScaled(2.0, 2, 3.0);
  759. glColor3d(1.000, 0.980, 0.980);
  760. glutSolidCube(1);
  761. glPopMatrix();
  762.  
  763. //box kiri atas rak samping alas tv tutup
  764. glPushMatrix();
  765. glTranslated(-3.0, 7.0, -10.5);
  766. glScaled(2.0, 2, 0.1);
  767. glColor3d(0.596, 0.984, 0.596);
  768. glutSolidCube(1);
  769. glPopMatrix();
  770.  
  771. //box kanan atas rak samping alas tv
  772. glPushMatrix();
  773. glTranslated(0.0, 7.0, -12.0);
  774. glScaled(2.0, 2, 3.0);
  775. glColor3d(1.000, 0.980, 0.980); //putih tulang
  776. glutSolidCube(1);
  777. glPopMatrix();
  778.  
  779. //box kanan atas rak samping alas tv tuutp
  780. glPushMatrix();
  781. glTranslated(0.0, 7.0, -10.5);
  782. glScaled(2.0, 2, 0.1);
  783. glColor3d(0.596, 0.984, 0.596); // hijau
  784. glutSolidCube(1);
  785. glPopMatrix();
  786.  
  787. //rak atas tv atas
  788. glPushMatrix();
  789. glTranslated(5.0, 8.0, -12.0);
  790. glScaled(5.0, 0.2, 6.0);
  791. glColor3d(0.596, 0.984, 0.596); // hijau
  792. glutSolidCube(1);
  793. glPopMatrix();
  794.  
  795. //rak atas tv bawah
  796. glPushMatrix();
  797. glTranslated(5.0, 6.0, -12.0);
  798. glScaled(5.0, 0.2, 6.0);
  799. glColor3d(1.000, 0.980, 0.980); //putih tulang
  800. glutSolidCube(1);
  801. glPopMatrix();
  802.  
  803. //tv
  804. glPushMatrix();
  805. glTranslated(6.0, 3.5, -9.8);
  806. glScaled(4.7, 2.7, 0.1);
  807. glColor3d(0.000, 0.000, 0.000);
  808. glutSolidCube(1);
  809. glPopMatrix();
  810.  
  811. //tv border
  812. glPushMatrix();
  813. glTranslated(6.0, 3.5, -10.0);
  814. glScaled(5.0, 3, 0.5);
  815. glColor3d(1.000, 0.980, 0.980); //putih tulang
  816. glutSolidCube(1);
  817. glPopMatrix();
  818.  
  819. //tv bracket
  820. glPushMatrix();
  821. glTranslated(6.0, 2.0, -10.0);
  822. glScaled(0.7, 1, 0.3);
  823. glColor3d(0.000, 0.000, 0.000);
  824. glutSolidCube(1);
  825. glPopMatrix();
  826.  
  827. //karpet depan tv
  828. glPushMatrix();
  829. glTranslated(3.7, 0.5, 2);
  830. glScaled(10.0, 0.07, 10);
  831. glColor3d(0.545, 0.000, 0.000); //merah tua
  832. glutSolidCube(1);
  833. glPopMatrix();
  834.  
  835. //meja pada karpet
  836. glPushMatrix();
  837. glTranslated(3.7, 0.6, 0);
  838. glScaled(4, 1.3, 4);
  839. glColor3d(1.0, 0.980, 0.980); //putih tulang
  840. glutSolidCube(1);
  841. glPopMatrix();
  842.  
  843. //sofa utama
  844. //tengah
  845. glPushMatrix();
  846. glTranslated(3.7, 1.7, 5);
  847. glScaled(8, 1, 3);
  848. glColor3d(1.000, 0.980, 0.980); //putih tulang
  849. glutSolidCube(1);
  850. glPopMatrix();
  851.  
  852. //kanan
  853. glPushMatrix();
  854. glTranslated(8.2, 1.9, 5);
  855. glScaled(1, 3, 3);
  856. glColor3d(1.000, 0.980, 0.980); //putih tulang
  857. glutSolidCube(1);
  858. glPopMatrix();
  859.  
  860. //kiri
  861. glPushMatrix();
  862. glTranslated(-0.8, 1.9, 5);
  863. glScaled(1, 3, 3);
  864. glColor3d(1.000, 0.980, 0.980); //putih tulang
  865. glutSolidCube(1);
  866. glPopMatrix();
  867.  
  868. //atas belakang
  869. glPushMatrix();
  870. glTranslated(3.7, 2.9, 6.15);
  871. glScaled(8, 1.3, 0.7);
  872. glColor3d(1.000, 0.980, 0.980); //putih tulang
  873. glutSolidCube(1);
  874. glPopMatrix();
  875.  
  876. /////////////////////////////////////RUANG TAMU - MUHAMMAD ILHAM 10116297
  877. //alas tv
  878. glPushMatrix();
  879. glTranslated(5.0, 1.0, -12.0);
  880. glScaled(8.0, 1, 6.0);
  881. glColor3d(1.000, 0.980, 0.980);
  882. glutSolidCube(1);
  883. glPopMatrix();
  884.  
  885. //rak samping alas tv
  886. glPushMatrix();
  887. glTranslated(-1.0, 2.0, -12.0);
  888. glScaled(8.0, 1, 6.0);
  889. glColor3d(0.596, 0.984, 0.596);
  890. glutSolidCube(1);
  891. glPopMatrix();
  892.  
  893. //box kiri atas rak samping alas tv
  894. glPushMatrix();
  895. glTranslated(-3.0, 7.0, -12.0);
  896. glScaled(2.0, 2, 3.0);
  897. glColor3d(1.000, 0.980, 0.980);
  898. glutSolidCube(1);
  899. glPopMatrix();
  900.  
  901. //box kiri atas rak samping alas tv tutup
  902. glPushMatrix();
  903. glTranslated(-3.0, 7.0, -10.5);
  904. glScaled(2.0, 2, 0.1);
  905. glColor3d(0.596, 0.984, 0.596);
  906. glutSolidCube(1);
  907. glPopMatrix();
  908.  
  909. //box kanan atas rak samping alas tv
  910. glPushMatrix();
  911. glTranslated(0.0, 7.0, -12.0);
  912. glScaled(2.0, 2, 3.0);
  913. glColor3d(1.000, 0.980, 0.980); //putih tulang
  914. glutSolidCube(1);
  915. glPopMatrix();
  916.  
  917. //box kanan atas rak samping alas tv tuutp
  918. glPushMatrix();
  919. glTranslated(0.0, 7.0, -10.5);
  920. glScaled(2.0, 2, 0.1);
  921. glColor3d(0.596, 0.984, 0.596); // hijau
  922. glutSolidCube(1);
  923. glPopMatrix();
  924.  
  925. //rak atas tv atas
  926. glPushMatrix();
  927. glTranslated(5.0, 8.0, -12.0);
  928. glScaled(5.0, 0.2, 6.0);
  929. glColor3d(0.596, 0.984, 0.596); // hijau
  930. glutSolidCube(1);
  931. glPopMatrix();
  932.  
  933. //rak atas tv bawah
  934. glPushMatrix();
  935. glTranslated(5.0, 6.0, -12.0);
  936. glScaled(5.0, 0.2, 6.0);
  937. glColor3d(1.000, 0.980, 0.980); //putih tulang
  938. glutSolidCube(1);
  939. glPopMatrix();
  940.  
  941. //tv
  942. glPushMatrix();
  943. glTranslated(6.0, 3.5, -9.8);
  944. glScaled(4.7, 2.7, 0.1);
  945. glColor3d(0.000, 0.000, 0.000);
  946. glutSolidCube(1);
  947. glPopMatrix();
  948.  
  949. //tv border
  950. glPushMatrix();
  951. glTranslated(6.0, 3.5, -10.0);
  952. glScaled(5.0, 3, 0.5);
  953. glColor3d(1.000, 0.980, 0.980); //putih tulang
  954. glutSolidCube(1);
  955. glPopMatrix();
  956.  
  957. //tv bracket
  958. glPushMatrix();
  959. glTranslated(6.0, 2.0, -10.0);
  960. glScaled(0.7, 1, 0.3);
  961. glColor3d(0.000, 0.000, 0.000);
  962. glutSolidCube(1);
  963. glPopMatrix();
  964.  
  965. //karpet depan tv
  966. glPushMatrix();
  967. glTranslated(3.7, 0.5, 2);
  968. glScaled(10.0, 0.07, 10);
  969. glColor3d(0.545, 0.000, 0.000); //merah tua
  970. glutSolidCube(1);
  971. glPopMatrix();
  972.  
  973. //meja pada karpet
  974. glPushMatrix();
  975. glTranslated(3.7, 1.5, 0);
  976. glScaled(4, 1.7, 4);
  977. glColor3d(1.0, 0.980, 0.980); //putih tulang
  978. glutSolidCube(1);
  979. glPopMatrix();
  980.  
  981. //sofa utama
  982. //tengah
  983. glPushMatrix();
  984. glTranslated(3.7, 1.7, 5);
  985. glScaled(8, 1, 3);
  986. glColor3d(1.000, 0.980, 0.980); //putih tulang
  987. glutSolidCube(1);
  988. glPopMatrix();
  989.  
  990. //kanan
  991. glPushMatrix();
  992. glTranslated(8.2, 1.9, 5);
  993. glScaled(1, 3, 3);
  994. glColor3d(1.000, 0.980, 0.980); //putih tulang
  995. glutSolidCube(1);
  996. glPopMatrix();
  997.  
  998. //kiri
  999. glPushMatrix();
  1000. glTranslated(-0.8, 1.9, 5);
  1001. glScaled(1, 3, 3);
  1002. glColor3d(1.000, 0.980, 0.980); //putih tulang
  1003. glutSolidCube(1);
  1004. glPopMatrix();
  1005.  
  1006. //atas belakang
  1007. glPushMatrix();
  1008. glTranslated(3.7, 2.9, 6.15);
  1009. glScaled(8, 1.3, 0.7);
  1010. glColor3d(1.000, 0.980, 0.980); //putih tulang
  1011. glutSolidCube(1);
  1012. glPopMatrix();
  1013.  
  1014. //sofa kecil
  1015. //tengah
  1016. glPushMatrix();
  1017. glTranslated(-6.5, 1.7, 0);
  1018. glScaled(3, 1, 3);
  1019. glColor3d(1.000, 0.980, 0.980); //putih tulang
  1020. glutSolidCube(1);
  1021. glPopMatrix();
  1022.  
  1023. //kanan
  1024. glPushMatrix();
  1025. glTranslated(-6.5, 1.9, 2);
  1026. glScaled(3, 3, 1);
  1027. glColor3d(1.000, 0.980, 0.980); //putih tulang
  1028. glutSolidCube(1);
  1029. glPopMatrix();
  1030.  
  1031. //kiri
  1032. glPushMatrix();
  1033. glTranslated(-6.5, 1.9, -1.7);
  1034. glScaled(3, 3, 1);
  1035. glColor3d(1.000, 0.980, 0.980); //putih tulang
  1036. glutSolidCube(1);
  1037. glPopMatrix();
  1038.  
  1039. //atas belakang
  1040. glPushMatrix();
  1041. glTranslated(-7.6, 2.9, 0.2);
  1042. glScaled(1, 1.3, 2.8);
  1043. glColor3d(1.000, 0.980, 0.980); //putih tulang
  1044. glutSolidCube(1);
  1045. glPopMatrix();
  1046.  
  1047. ///////////////////////////////////////WC KAMAR MANDI - KEMAS RISMAN 10116313
  1048. //Bak Mandi 1 sumbu z
  1049. glPushMatrix();
  1050. glTranslated(21.5, 2.0, -11.3);
  1051. glScaled(0.5, 4.0, 7.0);
  1052. glColor3d(1.0, 1.0, 1.0);
  1053. glutSolidCube(1);
  1054. glPopMatrix();
  1055.  
  1056. //Bak Mandi 2 sumbu x
  1057. glPushMatrix();
  1058. glTranslated(25.5, 2.0, -8.0);
  1059. glScaled(8.0, 4.0, 0.5);
  1060. glColor3d(1.0, 1.0, 1.0);
  1061. glutSolidCube(1);
  1062. glPopMatrix();
  1063.  
  1064. //Alas WC
  1065. glPushMatrix();
  1066. glTranslated(27.0, 0.8, -6.0);
  1067. glScaled(5.0, 1.0, 4.3);
  1068. glColor3d(1.0, 1.0, 1.0);
  1069. glutSolidCube(1);
  1070. glPopMatrix();
  1071.  
  1072. glutSwapBuffers();
  1073. glutPostRedisplay();
  1074.  
  1075. }
  1076. int main(int argc, char* argv[]) {
  1077. glutInit(&argc, argv);
  1078. glutInitWindowSize(800, 600);
  1079. glutInitWindowPosition(200, 100);
  1080. glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
  1081.  
  1082. glutCreateWindow("Kelompok Apartemen");
  1083. glutReshapeFunc(resize);
  1084. glutDisplayFunc(display);
  1085. glutKeyboardFunc(keyboard);
  1086. glutSpecialFunc(specialkeys);
  1087.  
  1088. glClearColor(1, 1, 1, 1);
  1089. glEnable(GL_CULL_FACE);
  1090. glCullFace(GL_BACK);
  1091.  
  1092. glEnable(GL_DEPTH_TEST);
  1093. glDepthFunc(GL_LESS);
  1094.  
  1095. glEnable(GL_LIGHT0);
  1096. glEnable(GL_NORMALIZE);
  1097. glEnable(GL_COLOR_MATERIAL);
  1098. glEnable(GL_LIGHTING);
  1099.  
  1100. glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
  1101. glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
  1102. glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
  1103. glLightfv(GL_LIGHT0, GL_POSITION, light_position);
  1104.  
  1105. glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
  1106. glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
  1107. glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
  1108. glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);
  1109.  
  1110. glutMainLoop();
  1111. return EXIT_SUCCESS;
  1112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement