SHARE
TWEET

sakitx

a guest Dec 17th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * GLUT Shapes Demo
  3.  *
  4.  * Written by Nigel Stewart November 2003
  5.  *
  6.  * This program is test harness for the sphere, cone
  7.  * and torus shapes in GLUT.
  8.  *
  9.  * Spinning wireframe and smooth shaded shapes are
  10.  * displayed until the ESC or q key is pressed.  The
  11.  * number of geometry stacks and slices can be adjusted
  12.  * using the + and - keys.
  13.  */
  14. #ifdef __APPLE__
  15. #include <GLUT/glut.h>
  16. #else
  17. #include <GL/glut.h>
  18. #endif
  19.  
  20. #include <iostream>
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <stdio.h>
  24. #include <ctime>
  25. #include <cstdlib>
  26. #include <stdlib.h>
  27. #include <stdio.h>
  28. #include <math.h>
  29.  
  30.  
  31.  
  32.  
  33.  
  34. float agerak[] = {-45,10};
  35. float bgerak[] = {-45,0};
  36. int geraka = 0;
  37. int gerakb = 0;
  38. float timerandom = 0;
  39.  
  40. float ortho[] = {-60,60,-40,60};
  41.  
  42. float kakikiri[] = {0,     0,     4,    0,    4,    1,    0,    1};
  43. float kakikanan[] = {6,     0,     10,    0,    10,    1,    6,    1};
  44.  
  45. float betiskiri[] = {2.5,     1,     2.5,    12,    4,    12,    4,    1};
  46. float betiskanan[] = {7.5,     1,     7.5,    12,    8.5,    12,    8.5,    1};
  47.  
  48. float shadowkakikiri[] = {1.5,     1,     1.5,    12,    2.5,    12,    2.5,    1};
  49. float shadowkakikanan[] = {6,     12,     6,    1,    7.5,    1,    7.5,    12};
  50.  
  51. float pinggangkiri[] = {1.5,     12,     1.5,    14,    2.5,    14,    2.5,    12};
  52. float pinggangtengah[] = {2.5,     12,     2.5,    14,    7.5,    14,    7.5,    12};
  53. float pinggangkanan[] = {7.5,     12,     7.5,    14,    8.5,    14,    8.5,    12};
  54.  
  55. float badan[] = {1,     14,     1,    25,    9,    25,    9,    14};
  56.  
  57. float shadowbadankiri[] = {1,     14,     1,    23,    2,    23,    2,    14};
  58. float shadowbadankanan[] = {8,     14,     8,    23,    9,    23,    9,    14};
  59. float shadowbadantengah[] = {4.8,     16,     4.8,    25,    5.3,    25,    5.3,    16};
  60.  
  61. float lengankiri[] = {0,     15,     0,    25,    1,    25,    1,    15};
  62. float lengankanan[] = {9,     15,     9,    25,    10,    25,    10,    15};
  63.  
  64. float tangankiri[] = {0,     14,     0,    15,    1,    15,    1,    14};
  65. float tangankanan[] = {9,     14,     9,    15,    10,    15,    10,    14};
  66.  
  67. float brosskiri[] = {1,     24.5,     1,    25.2,    3,    25.2,    3,    24.5};
  68. float brosskanan[] = {7,     24.5,     7,    25.2,    9,    25.2,    9,    24.5};
  69.  
  70. float kerahkiri[] = {3.2,     25.8,     3.2,    27,    4.4,    27,    4.4,    25.8};
  71. float kerahtengah[] = {3.2,     25,     3.2,    25.8,    6.8,    25.8,    6.8,    25};
  72. float kerahkanan[] = {5.6,     25.8,     5.6,    27,    6.8,    27,    6.8,    25.8};
  73.  
  74. float leherkiri[] = {3.2,     27,     3.2,    27.6,    5.6,    27.6,    5.6,    27};
  75. float leherkanan[] = {5.6,    27,     5.6,    27.6,    6.8,    27.6,    6.8,    27};
  76. float leherbawah[] = {4.4,     25.8,     4.4,    27,    5.6,    27,    5.6,    25.8};
  77. float leherbelakang[] = {5.6,     27.6,     5.6,    29.6,    6.8,    29.6,    6.8,    27.6};
  78.  
  79. float wajah[] = {2.2,     27.6,     2.2,    31.6,    5.6,    31.6,    5.6,    27.6};
  80. float alis[] = {2.2,     31,     2.2,    31.4,    3.5,    31.4,    3.5,    31};
  81. float matakiri[] = {2.2,     30.4,     2.2,    30.8,    2.4,    30.8,    2.4,    30.4};
  82. float matakanan[] = {3.1,     30.4,     3.1,    30.8,    3.5,    30.8,    3.5,    30.4};
  83. float hidung[] = {2.4,     29.2,     2.4,    30.4,    3.1,    30.4,    3.1,    29.2};
  84.  
  85. float helmbelakang[] = {5.6,     29.6,     5.6,    32,    6.8,    32,    6.8,    29.6};
  86. float helmalas[] = {2.2,     31.6,     2.2,    32,    5.6,    32,    5.6,    31.6};
  87. float helmatas[] = {2.2,     32,     2.2,    33.2,    6.7,    33.2,    6.8,    32};
  88. float helmemas[] = {2.3,     33.2,     2.3,    33.4,    6.7,    33.4,    6.7,    33.2};
  89. float helmlapisbawah[] = {2.3,     33.4,     2.3,    33.7,    6.7,    33.7,    6.7,    33.4};
  90. float helmlapisatas[] = {2.4,     33.7,     2.4,    33.9,    6.6,    33.9,    6.6,    33.7};
  91.  
  92.  
  93. float bodya[] = {-14,    -8,    -14,    -1,    18,    -1,    18,    -8};
  94. float bodyb[] = {-16,    -8,    -16,    -3,    -14,    -3,    -14,    -8};
  95. float bodyc[] = {-16.5,    -7,    -16.5,    -4.5,    -16,    -4,    -16,    -7.5};
  96. float bodyd[] = {-16,    -3,    -15.3,    -2,    -14,    -2,    -14,    -3};
  97.  
  98. float bodye[] = {-15.3,    -2,   -14,    -1,    -14,    -2}; //triangles
  99.  
  100. float bodyf[] = {-10,    -0,   -6.5,    0.5,    -6.5,    -2}; //triangles
  101.  
  102. float bodyg[] = {18,    -1.8,    18,    0,    19,    0,    20,    -1.8};
  103.  
  104. float bodyh[] = {18,    -3,    18,    -1.8,    20,    -1.8,    20,    -3};
  105. float bodyi[] = {18,    -3.5,    18,    -3,    20,    -3,    20.5,    -3.5};
  106. float bodyj[] = {18,    -6.5,    18,    -3.5,    20.5,    -3.5,    20.5,    -6.5};
  107. float bodyk[] = {18,    -8,    18,    -6.5,    20.5,    -6.5,    19,    -8};
  108.  
  109. float windowa[] = {-6.5,    0,    -6.5,    0.5,    -2,    4,    -2,    0};
  110. float windowb[] = {-2,    0,    -2,    4,    16,    4,    16,    0};
  111.  
  112. float windowc[] = {16,    -0,   16,    4,    19,    0}; //triangles
  113.  
  114. //darkyellow
  115.  
  116. float bodyx[] = {-14,    -1,    -11,    0,    -10,    0,    -10,    -1};
  117. float bodyy[] = {-10,    -1,    -10,    0,    18,    0,    18,    -1};
  118.  
  119. float decala[] = {-10,    -2,    -10,    0,    18,    0,    18,    -2};
  120. float decalb[] = {-14,    -2,    -14,    -1,    -10,    -1,    10,    -2};
  121.  
  122. //grey
  123. float windowdecala[] = {-5,    0,    -2,    4,    -1,    4,    -4,    0};
  124. float windowdecalb[] = {6.5,    0,    6.88,    4,    7.66,    4,    8,    0};
  125. float windowdecalc[] = {16,    0,    14,    4,    16,    4,    18,    0};
  126.  
  127. //grey
  128. float bumpera[] = {-16,    -8,    -16,    -7,    -14,    -7,    -14,    -8};
  129. float bumperb[] = {-8,    -8,    -8,    -7,    12,    -7,    12,    -8};
  130. float bumperc[] = {18,    -8,    18,    -7,    20,    -7,    19,    -8};
  131.  
  132. //black
  133. float bandepan[] = {-13,    -9,    -13,    -5,    -9,    -5,    -9,    -9};
  134. float bandepana[] = {-13,    -5,    -13,    -4,    -9,    -4,    -9,    -5};
  135. float bandepanb[] = {-13,    -10,    -13,    -9,    -9,    -9,    -9,    -10};
  136. float bandepanc[] = {-14,    -9,    -14,    -5,    -13,    -4,    -13,    -10};
  137. float bandepand[] = {-9,    -10,    -9,    -4,    -8,    -5,    -8,    -9};
  138. float bandepane[] = {-13,    -6,   -13,    -5,    -12,    -5};
  139. float bandepanf[] = {-10,    -5,   -9,    -5,    -9,    -6};
  140. float bandepang[] = {-13,    -9,   -13,    -8,    -12,    -9};
  141. float bandepanh[] = {-10,    -9,   -9,    -8,    -9,    -9};
  142.  
  143. float banbelakang[] = {13,    -9,    13,    -5,    17,    -5,    17,    -9};
  144. float banbelakanga[] = {12,    -5,    13,    -4,    14,    -5,    13,    -6};
  145. float banbelakangb[] = {16,    -5,    17,    -4,    18,    -5,    17,    -6};
  146. float banbelakangc[] = {12,    -9,    13,    -8,    14,    -9,    13,    -10};
  147. float banbelakangd[] = {16,    -9,    17,    -8,    18,    -9,    17,    -10};
  148. float banbelakange[] = {12,    -9,    12,    -5,    13,    -6,    13,    -8};
  149. float banbelakangf[] = {17,    -8,    17,    -6,    18,    -5,    18,    -9};
  150. float banbelakangg[] = {14,    -5,    13,    -4,    17,    -4,    16,    -5};
  151. float banbelakangh[] = {14,    -9,    16,    -9,    17,    -10,   13,    -10};
  152.  
  153. float roof[] = {-2,    4,    -1.5,    4.5,    15.5,    4.5,    16,    4};
  154.  
  155.  
  156.  
  157. float stage_batas_atas[] = {-60,    50,    -60,    55,    60,    55,    60,    50};
  158. void batas_atas()
  159. {
  160.     glColor3ub(128,128,128);
  161.     glBegin(GL_POLYGON);
  162.     glVertex2f(stage_batas_atas[0],stage_batas_atas[1]);
  163.     glVertex2d(stage_batas_atas[2],stage_batas_atas[3]);
  164.     glVertex2d(stage_batas_atas[4],stage_batas_atas[5]);
  165.     glVertex2d(stage_batas_atas[6],stage_batas_atas[7]);
  166.     glEnd();
  167. }
  168.  
  169. float stage_batas_bawah[] = {-60,    -30,    -60,    -35,    60,    -35,    60,    -30};
  170. void batas_bawah()
  171. {
  172.     glColor3ub(128,128,128);
  173.     glBegin(GL_POLYGON);
  174.     glVertex2f(stage_batas_bawah[0],stage_batas_bawah[1]);
  175.     glVertex2d(stage_batas_bawah[2],stage_batas_bawah[3]);
  176.     glVertex2d(stage_batas_bawah[4],stage_batas_bawah[5]);
  177.     glVertex2d(stage_batas_bawah[6],stage_batas_bawah[7]);
  178.     glEnd();
  179. }
  180.  
  181. float stage_jalan[] = {-60,    -30,    -60,    50,    60,    50,    60,    -30};
  182. void jalan()
  183. {
  184.     glColor3ub(64,64,64);
  185.     glBegin(GL_POLYGON);
  186.     glVertex2f(stage_jalan[0],stage_jalan[1]);
  187.     glVertex2d(stage_jalan[2],stage_jalan[3]);
  188.     glVertex2d(stage_jalan[4],stage_jalan[5]);
  189.     glVertex2d(stage_jalan[6],stage_jalan[7]);
  190.     glEnd();
  191. }
  192.  
  193. float stage_bg[] = {-60,    -40,    -60,    60,    60,    60,    60,    -40};
  194. void background()
  195. {
  196.    
  197.    
  198.     glColor3ub(153,204,0);
  199.     glBegin(GL_POLYGON);
  200.     glVertex2f(stage_bg[0],stage_bg[1]);
  201.     glVertex2d(stage_bg[2],stage_bg[3]);
  202.     glVertex2d(stage_bg[4],stage_bg[5]);
  203.     glVertex2d(stage_bg[6],stage_bg[7]);
  204.     glEnd();
  205.    
  206.     jalan();
  207.     batas_atas();
  208.     batas_bawah();
  209.    
  210. }
  211.  
  212. void kotak()
  213. {
  214.     glTranslated(-10,-60,0);
  215.     glColor3b(0.5,0.5,0);
  216.     glBegin(GL_POLYGON);
  217.     glVertex2f(0,0);
  218.     glVertex2d(0,5);
  219.     glVertex2d(5,5);
  220.     glVertex2d(5,0);
  221.     glEnd();
  222. }
  223.  
  224. float coll_mobil1[] = {-16.5,    -10,    -16.5,    5,    21,    5,    21,    -10};
  225. void mobil1()
  226. {
  227.     glTranslated(agerak[0],agerak[1],0);
  228.     glScaled(-0.50,0.50,0);
  229.    
  230. //    glBegin(GL_QUADS);
  231. //    glVertex2f(coll_mobil1[0], coll_mobil1[1]);
  232. //    glVertex2f(coll_mobil1[2], coll_mobil1[3]);
  233. //    glVertex2f(coll_mobil1[4], coll_mobil1[5]);
  234. //    glVertex2f(coll_mobil1[6], coll_mobil1[7]);
  235. //    glEnd();
  236. //
  237.     glBegin(GL_QUADS);
  238.     glColor3ub(147, 195, 65);
  239.     glVertex2f(bodya[0], bodya[1]);
  240.     glVertex2f(bodya[2], bodya[3]);
  241.     glVertex2f(bodya[4], bodya[5]);
  242.     glVertex2f(bodya[6], bodya[7]);
  243.     glEnd();
  244.    
  245.     glBegin(GL_QUADS);
  246.     glColor3ub(147, 195, 65);
  247.     glVertex2f(bodyb[0], bodyb[1]);
  248.     glVertex2f(bodyb[2], bodyb[3]);
  249.     glVertex2f(bodyb[4], bodyb[5]);
  250.     glVertex2f(bodyb[6], bodyb[7]);
  251.     glEnd();
  252.    
  253.     glBegin(GL_QUADS);
  254.     glColor3ub(147, 195, 65);
  255.     glVertex2f(bodyc[0], bodyc[1]);
  256.     glVertex2f(bodyc[2], bodyc[3]);
  257.     glVertex2f(bodyc[4], bodyc[5]);
  258.     glVertex2f(bodyc[6], bodyc[7]);
  259.     glEnd();
  260.    
  261.     glBegin(GL_QUADS);
  262.     glColor3ub(255,255,255);
  263.     glVertex2f(bodyd[0], bodyd[1]);
  264.     glVertex2f(bodyd[2], bodyd[3]);
  265.     glVertex2f(bodyd[4], bodyd[5]);
  266.     glVertex2f(bodyd[6], bodyd[7]);
  267.     glEnd();
  268.    
  269.     glBegin(GL_TRIANGLES);
  270.     glColor3ub(255,255,255);
  271.     glVertex2f(bodye[0], bodye[1]);
  272.     glVertex2f(bodye[2], bodye[3]);
  273.     glVertex2f(bodye[4], bodye[5]);
  274.     glEnd();
  275.    
  276.     glBegin(GL_TRIANGLES);
  277.     glColor3ub(47, 177, 56);
  278.     glVertex2f(bodyf[0], bodyf[1]);
  279.     glVertex2f(bodyf[2], bodyf[3]);
  280.     glVertex2f(bodyf[4], bodyf[5]);
  281.     glEnd();
  282.    
  283.     glBegin(GL_QUADS);
  284.     glColor3ub(255,135,43);
  285.     glVertex2f(bodyg[0], bodyg[1]);
  286.     glVertex2f(bodyg[2], bodyg[3]);
  287.     glVertex2f(bodyg[4], bodyg[5]);
  288.     glVertex2f(bodyg[6], bodyg[7]);
  289.     glEnd();
  290.    
  291.     glBegin(GL_QUADS);
  292.     glColor3ub(147, 195, 65);
  293.     glVertex2f(bodyh[0], bodyh[1]);
  294.     glVertex2f(bodyh[2], bodyh[3]);
  295.     glVertex2f(bodyh[4], bodyh[5]);
  296.     glVertex2f(bodyh[6], bodyh[7]);
  297.     glEnd();
  298.    
  299.     glBegin(GL_QUADS);
  300.     glColor3ub(147, 195, 65);
  301.     glVertex2f(bodyi[0], bodyi[1]);
  302.     glVertex2f(bodyi[2], bodyi[3]);
  303.     glVertex2f(bodyi[4], bodyi[5]);
  304.     glVertex2f(bodyi[6], bodyi[7]);
  305.     glEnd();
  306.    
  307.     glBegin(GL_QUADS);
  308.     glColor3ub(147, 195, 65);
  309.     glVertex2f(bodyj[0], bodyj[1]);
  310.     glVertex2f(bodyj[2], bodyj[3]);
  311.     glVertex2f(bodyj[4], bodyj[5]);
  312.     glVertex2f(bodyj[6], bodyj[7]);
  313.     glEnd();
  314.    
  315.     glBegin(GL_QUADS);
  316.     glColor3ub(147, 195, 65);
  317.     glVertex2f(bodyk[0], bodyk[1]);
  318.     glVertex2f(bodyk[2], bodyk[3]);
  319.     glVertex2f(bodyk[4], bodyk[5]);
  320.     glVertex2f(bodyk[6], bodyk[7]);
  321.     glEnd();
  322.    
  323.     glBegin(GL_QUADS);
  324.     glColor3ub(47, 177, 56);
  325.     glVertex2f(bodyx[0], bodyx[1]);
  326.     glVertex2f(bodyx[2], bodyx[3]);
  327.     glVertex2f(bodyx[4], bodyx[5]);
  328.     glVertex2f(bodyx[6], bodyx[7]);
  329.     glEnd();
  330.    
  331.     glBegin(GL_QUADS);
  332.     glColor3ub(47, 177, 56);
  333.     glVertex2f(bodyy[0], bodyy[1]);
  334.     glVertex2f(bodyy[2], bodyy[3]);
  335.     glVertex2f(bodyy[4], bodyy[5]);
  336.     glVertex2f(bodyy[6], bodyy[7]);
  337.     glEnd();
  338.    
  339.     glBegin(GL_QUADS);
  340.     glColor3ub(84,84,84);
  341.     glVertex2f(windowa[0], windowa[1]);
  342.     glVertex2f(windowa[2], windowa[3]);
  343.     glVertex2f(windowa[4], windowa[5]);
  344.     glVertex2f(windowa[6], windowa[7]);
  345.     glEnd();
  346.    
  347.     glBegin(GL_QUADS);
  348.     glColor3ub(84,84,84);
  349.     glVertex2f(windowb[0], windowb[1]);
  350.     glVertex2f(windowb[2], windowb[3]);
  351.     glVertex2f(windowb[4], windowb[5]);
  352.     glVertex2f(windowb[6], windowb[7]);
  353.     glEnd();
  354.    
  355.     glBegin(GL_TRIANGLES);
  356.     glColor3ub(84,84,84);
  357.     glVertex2f(windowc[0], windowc[1]);
  358.     glVertex2f(windowc[2], windowc[3]);
  359.     glVertex2f(windowc[4], windowc[5]);
  360.     glEnd();
  361.    
  362.     glBegin(GL_QUADS);
  363.     glColor3ub(47, 177, 56);
  364.     glVertex2f(decala[0], decala[1]);
  365.     glVertex2f(decala[2], decala[3]);
  366.     glVertex2f(decala[4], decala[5]);
  367.     glVertex2f(decala[6], decala[7]);
  368.     glEnd();
  369.    
  370.     glBegin(GL_QUADS);
  371.     glColor3ub(47, 177, 56);
  372.     glVertex2f(decalb[0], decalb[1]);
  373.     glVertex2f(decalb[2], decalb[3]);
  374.     glVertex2f(decalb[4], decalb[5]);
  375.     glVertex2f(decalb[6], decalb[7]);
  376.     glEnd();
  377.    
  378.     glBegin(GL_QUADS);
  379.     glColor3ub(71,71,71);
  380.     glVertex2f(windowdecala[0], windowdecala[1]);
  381.     glVertex2f(windowdecala[2], windowdecala[3]);
  382.     glVertex2f(windowdecala[4], windowdecala[5]);
  383.     glVertex2f(windowdecala[6], windowdecala[7]);
  384.     glEnd();
  385.    
  386.     glBegin(GL_QUADS);
  387.     glColor3ub(71,71,71);
  388.     glVertex2f(windowdecalb[0], windowdecalb[1]);
  389.     glVertex2f(windowdecalb[2], windowdecalb[3]);
  390.     glVertex2f(windowdecalb[4], windowdecalb[5]);
  391.     glVertex2f(windowdecalb[6], windowdecalb[7]);
  392.     glEnd();
  393.    
  394.     glBegin(GL_QUADS);
  395.     glColor3ub(71,71,71);
  396.     glVertex2f(windowdecalc[0], windowdecalc[1]);
  397.     glVertex2f(windowdecalc[2], windowdecalc[3]);
  398.     glVertex2f(windowdecalc[4], windowdecalc[5]);
  399.     glVertex2f(windowdecalc[6], windowdecalc[7]);
  400.     glEnd();
  401.    
  402.     glBegin(GL_QUADS);
  403.     glColor3ub(232,232,232);
  404.     glVertex2f(roof[0], roof[1]);
  405.     glVertex2f(roof[2], roof[3]);
  406.     glVertex2f(roof[4], roof[5]);
  407.     glVertex2f(roof[6], roof[7]);
  408.     glEnd();
  409.    
  410.     glBegin(GL_QUADS);
  411.     glColor3ub(71,71,71);
  412.     glVertex2f(bumpera[0], bumpera[1]);
  413.     glVertex2f(bumpera[2], bumpera[3]);
  414.     glVertex2f(bumpera[4], bumpera[5]);
  415.     glVertex2f(bumpera[6], bumpera[7]);
  416.     glEnd();
  417.    
  418.     glBegin(GL_QUADS);
  419.     glColor3ub(71,71,71);
  420.     glVertex2f(bumperb[0], bumperb[1]);
  421.     glVertex2f(bumperb[2], bumperb[3]);
  422.     glVertex2f(bumperb[4], bumperb[5]);
  423.     glVertex2f(bumperb[6], bumperb[7]);
  424.     glEnd();
  425.    
  426.     glBegin(GL_QUADS);
  427.     glColor3ub(71,71,71);
  428.     glVertex2f(bumperc[0], bumperc[1]);
  429.     glVertex2f(bumperc[2], bumperc[3]);
  430.     glVertex2f(bumperc[4], bumperc[5]);
  431.     glVertex2f(bumperc[6], bumperc[7]);
  432.     glEnd();
  433.    
  434.     glBegin(GL_QUADS);
  435.     glColor3ub(255,255,255);
  436.     glVertex2f(bandepan[0], bandepan[1]);
  437.     glVertex2f(bandepan[2], bandepan[3]);
  438.     glVertex2f(bandepan[4], bandepan[5]);
  439.     glVertex2f(bandepan[6], bandepan[7]);
  440.     glEnd();
  441.    
  442.     glBegin(GL_QUADS);
  443.     glColor3ub(0,0,0);
  444.     glVertex2f(bandepana[0], bandepana[1]);
  445.     glVertex2f(bandepana[2], bandepana[3]);
  446.     glVertex2f(bandepana[4], bandepana[5]);
  447.     glVertex2f(bandepana[6], bandepana[7]);
  448.     glEnd();
  449.    
  450.     glBegin(GL_QUADS);
  451.     glColor3ub(0,0,0);
  452.     glVertex2f(bandepanb[0], bandepanb[1]);
  453.     glVertex2f(bandepanb[2], bandepanb[3]);
  454.     glVertex2f(bandepanb[4], bandepanb[5]);
  455.     glVertex2f(bandepanb[6], bandepanb[7]);
  456.     glEnd();
  457.    
  458.     glBegin(GL_QUADS);
  459.     glColor3ub(0,0,0);
  460.     glVertex2f(bandepanc[0], bandepanc[1]);
  461.     glVertex2f(bandepanc[2], bandepanc[3]);
  462.     glVertex2f(bandepanc[4], bandepanc[5]);
  463.     glVertex2f(bandepanc[6], bandepanc[7]);
  464.     glEnd();
  465.    
  466.     glBegin(GL_QUADS);
  467.     glColor3ub(0,0,0);
  468.     glVertex2f(bandepand[0], bandepand[1]);
  469.     glVertex2f(bandepand[2], bandepand[3]);
  470.     glVertex2f(bandepand[4], bandepand[5]);
  471.     glVertex2f(bandepand[6], bandepand[7]);
  472.     glEnd();
  473.    
  474.     glBegin(GL_TRIANGLES);
  475.     glColor3ub(0,0,0);
  476.     glVertex2f(bandepane[0], bandepane[1]);
  477.     glVertex2f(bandepane[2], bandepane[3]);
  478.     glVertex2f(bandepane[4], bandepane[5]);
  479.     glEnd();
  480.    
  481.     glBegin(GL_TRIANGLES);
  482.     glColor3ub(0,0,0);
  483.     glVertex2f(bandepanf[0], bandepanf[1]);
  484.     glVertex2f(bandepanf[2], bandepanf[3]);
  485.     glVertex2f(bandepanf[4], bandepanf[5]);
  486.     glEnd();
  487.    
  488.     glBegin(GL_TRIANGLES);
  489.     glColor3ub(0,0,0);
  490.     glVertex2f(bandepang[0], bandepang[1]);
  491.     glVertex2f(bandepang[2], bandepang[3]);
  492.     glVertex2f(bandepang[4], bandepang[5]);
  493.     glEnd();
  494.    
  495.     glBegin(GL_TRIANGLES);
  496.     glColor3ub(0,0,0);
  497.     glVertex2f(bandepanh[0], bandepanh[1]);
  498.     glVertex2f(bandepanh[2], bandepanh[3]);
  499.     glVertex2f(bandepanh[4], bandepanh[5]);
  500.     glEnd();
  501.    
  502.     glBegin(GL_QUADS);
  503.     glColor3ub(255,255,255);
  504.     glVertex2f(banbelakang[0], banbelakang[1]);
  505.     glVertex2f(banbelakang[2], banbelakang[3]);
  506.     glVertex2f(banbelakang[4], banbelakang[5]);
  507.     glVertex2f(banbelakang[6], banbelakang[7]);
  508.     glEnd();
  509.    
  510.     glBegin(GL_QUADS);
  511.     glColor3ub(0,0,0);
  512.     glVertex2f(banbelakanga[0], banbelakanga[1]);
  513.     glVertex2f(banbelakanga[2], banbelakanga[3]);
  514.     glVertex2f(banbelakanga[4], banbelakanga[5]);
  515.     glVertex2f(banbelakanga[6], banbelakanga[7]);
  516.     glEnd();
  517.    
  518.     glBegin(GL_QUADS);
  519.     glColor3ub(0,0,0);
  520.     glVertex2f(banbelakangb[0], banbelakangb[1]);
  521.     glVertex2f(banbelakangb[2], banbelakangb[3]);
  522.     glVertex2f(banbelakangb[4], banbelakangb[5]);
  523.     glVertex2f(banbelakangb[6], banbelakangb[7]);
  524.     glEnd();
  525.    
  526.     glBegin(GL_QUADS);
  527.     glColor3ub(0,0,0);
  528.     glVertex2f(banbelakangc[0], banbelakangc[1]);
  529.     glVertex2f(banbelakangc[2], banbelakangc[3]);
  530.     glVertex2f(banbelakangc[4], banbelakangc[5]);
  531.     glVertex2f(banbelakangc[6], banbelakangc[7]);
  532.     glEnd();
  533.    
  534.     glBegin(GL_QUADS);
  535.     glColor3ub(0,0,0);
  536.     glVertex2f(banbelakangd[0], banbelakangd[1]);
  537.     glVertex2f(banbelakangd[2], banbelakangd[3]);
  538.     glVertex2f(banbelakangd[4], banbelakangd[5]);
  539.     glVertex2f(banbelakangd[6], banbelakangd[7]);
  540.     glEnd();
  541.    
  542.     glBegin(GL_QUADS);
  543.     glColor3ub(0,0,0);
  544.     glVertex2f(banbelakange[0], banbelakange[1]);
  545.     glVertex2f(banbelakange[2], banbelakange[3]);
  546.     glVertex2f(banbelakange[4], banbelakange[5]);
  547.     glVertex2f(banbelakange[6], banbelakange[7]);
  548.     glEnd();
  549.    
  550.     glBegin(GL_QUADS);
  551.     glColor3ub(0,0,0);
  552.     glVertex2f(banbelakangf[0], banbelakangf[1]);
  553.     glVertex2f(banbelakangf[2], banbelakangf[3]);
  554.     glVertex2f(banbelakangf[4], banbelakangf[5]);
  555.     glVertex2f(banbelakangf[6], banbelakangf[7]);
  556.     glEnd();
  557.    
  558.     glBegin(GL_QUADS);
  559.     glColor3ub(0,0,0);
  560.     glVertex2f(banbelakangg[0], banbelakangg[1]);
  561.     glVertex2f(banbelakangg[2], banbelakangg[3]);
  562.     glVertex2f(banbelakangg[4], banbelakangg[5]);
  563.     glVertex2f(banbelakangg[6], banbelakangg[7]);
  564.     glEnd();
  565.    
  566.     glBegin(GL_QUADS);
  567.     glColor3ub(0,0,0);
  568.     glVertex2f(banbelakangh[0], banbelakangh[1]);
  569.     glVertex2f(banbelakangh[2], banbelakangh[3]);
  570.     glVertex2f(banbelakangh[4], banbelakangh[5]);
  571.     glVertex2f(banbelakangh[6], banbelakangh[7]);
  572.     glEnd();
  573.    
  574. }
  575.  
  576. float coll_mobil2[] = {-16.5,    -10,    -16.5,    5,    21,    5,    21,    -10};
  577. void mobil2()
  578. {
  579.     glTranslated(bgerak[0],bgerak[1],0);
  580.     glScaled(-0.50,0.50,0);
  581.    
  582. //    glBegin(GL_QUADS);
  583. //    glVertex2f(coll_mobil2[0], coll_mobil2[1]);
  584. //    glVertex2f(coll_mobil2[2], coll_mobil2[3]);
  585. //    glVertex2f(coll_mobil2[4], coll_mobil2[5]);
  586. //    glVertex2f(coll_mobil2[6], coll_mobil2[7]);
  587. //    glEnd();
  588.    
  589.     glBegin(GL_QUADS);
  590.     glColor3ub(255,195,65);
  591.     glVertex2f(bodya[0], bodya[1]);
  592.     glVertex2f(bodya[2], bodya[3]);
  593.     glVertex2f(bodya[4], bodya[5]);
  594.     glVertex2f(bodya[6], bodya[7]);
  595.     glEnd();
  596.    
  597.     glBegin(GL_QUADS);
  598.     glColor3ub(255,195,65);
  599.     glVertex2f(bodyb[0], bodyb[1]);
  600.     glVertex2f(bodyb[2], bodyb[3]);
  601.     glVertex2f(bodyb[4], bodyb[5]);
  602.     glVertex2f(bodyb[6], bodyb[7]);
  603.     glEnd();
  604.    
  605.     glBegin(GL_QUADS);
  606.     glColor3ub(255,195,65);
  607.     glVertex2f(bodyc[0], bodyc[1]);
  608.     glVertex2f(bodyc[2], bodyc[3]);
  609.     glVertex2f(bodyc[4], bodyc[5]);
  610.     glVertex2f(bodyc[6], bodyc[7]);
  611.     glEnd();
  612.    
  613.     glBegin(GL_QUADS);
  614.     glColor3ub(255,255,255);
  615.     glVertex2f(bodyd[0], bodyd[1]);
  616.     glVertex2f(bodyd[2], bodyd[3]);
  617.     glVertex2f(bodyd[4], bodyd[5]);
  618.     glVertex2f(bodyd[6], bodyd[7]);
  619.     glEnd();
  620.    
  621.     glBegin(GL_TRIANGLES);
  622.     glColor3ub(255,255,255);
  623.     glVertex2f(bodye[0], bodye[1]);
  624.     glVertex2f(bodye[2], bodye[3]);
  625.     glVertex2f(bodye[4], bodye[5]);
  626.     glEnd();
  627.    
  628.     glBegin(GL_TRIANGLES);
  629.     glColor3ub(255,184,56);
  630.     glVertex2f(bodyf[0], bodyf[1]);
  631.     glVertex2f(bodyf[2], bodyf[3]);
  632.     glVertex2f(bodyf[4], bodyf[5]);
  633.     glEnd();
  634.    
  635.     glBegin(GL_QUADS);
  636.     glColor3ub(255,135,43);
  637.     glVertex2f(bodyg[0], bodyg[1]);
  638.     glVertex2f(bodyg[2], bodyg[3]);
  639.     glVertex2f(bodyg[4], bodyg[5]);
  640.     glVertex2f(bodyg[6], bodyg[7]);
  641.     glEnd();
  642.    
  643.     glBegin(GL_QUADS);
  644.     glColor3ub(255,195,65);
  645.     glVertex2f(bodyh[0], bodyh[1]);
  646.     glVertex2f(bodyh[2], bodyh[3]);
  647.     glVertex2f(bodyh[4], bodyh[5]);
  648.     glVertex2f(bodyh[6], bodyh[7]);
  649.     glEnd();
  650.    
  651.     glBegin(GL_QUADS);
  652.     glColor3ub(255,195,65);
  653.     glVertex2f(bodyi[0], bodyi[1]);
  654.     glVertex2f(bodyi[2], bodyi[3]);
  655.     glVertex2f(bodyi[4], bodyi[5]);
  656.     glVertex2f(bodyi[6], bodyi[7]);
  657.     glEnd();
  658.    
  659.     glBegin(GL_QUADS);
  660.     glColor3ub(255,195,65);
  661.     glVertex2f(bodyj[0], bodyj[1]);
  662.     glVertex2f(bodyj[2], bodyj[3]);
  663.     glVertex2f(bodyj[4], bodyj[5]);
  664.     glVertex2f(bodyj[6], bodyj[7]);
  665.     glEnd();
  666.    
  667.     glBegin(GL_QUADS);
  668.     glColor3ub(255,195,65);
  669.     glVertex2f(bodyk[0], bodyk[1]);
  670.     glVertex2f(bodyk[2], bodyk[3]);
  671.     glVertex2f(bodyk[4], bodyk[5]);
  672.     glVertex2f(bodyk[6], bodyk[7]);
  673.     glEnd();
  674.    
  675.     glBegin(GL_QUADS);
  676.     glColor3ub(255,184,56);
  677.     glVertex2f(bodyx[0], bodyx[1]);
  678.     glVertex2f(bodyx[2], bodyx[3]);
  679.     glVertex2f(bodyx[4], bodyx[5]);
  680.     glVertex2f(bodyx[6], bodyx[7]);
  681.     glEnd();
  682.    
  683.     glBegin(GL_QUADS);
  684.     glColor3ub(255,184,56);
  685.     glVertex2f(bodyy[0], bodyy[1]);
  686.     glVertex2f(bodyy[2], bodyy[3]);
  687.     glVertex2f(bodyy[4], bodyy[5]);
  688.     glVertex2f(bodyy[6], bodyy[7]);
  689.     glEnd();
  690.    
  691.     glBegin(GL_QUADS);
  692.     glColor3ub(84,84,84);
  693.     glVertex2f(windowa[0], windowa[1]);
  694.     glVertex2f(windowa[2], windowa[3]);
  695.     glVertex2f(windowa[4], windowa[5]);
  696.     glVertex2f(windowa[6], windowa[7]);
  697.     glEnd();
  698.    
  699.     glBegin(GL_QUADS);
  700.     glColor3ub(84,84,84);
  701.     glVertex2f(windowb[0], windowb[1]);
  702.     glVertex2f(windowb[2], windowb[3]);
  703.     glVertex2f(windowb[4], windowb[5]);
  704.     glVertex2f(windowb[6], windowb[7]);
  705.     glEnd();
  706.    
  707.     glBegin(GL_TRIANGLES);
  708.     glColor3ub(84,84,84);
  709.     glVertex2f(windowc[0], windowc[1]);
  710.     glVertex2f(windowc[2], windowc[3]);
  711.     glVertex2f(windowc[4], windowc[5]);
  712.     glEnd();
  713.    
  714.     glBegin(GL_QUADS);
  715.     glColor3ub(255,184,56);
  716.     glVertex2f(decala[0], decala[1]);
  717.     glVertex2f(decala[2], decala[3]);
  718.     glVertex2f(decala[4], decala[5]);
  719.     glVertex2f(decala[6], decala[7]);
  720.     glEnd();
  721.    
  722.     glBegin(GL_QUADS);
  723.     glColor3ub(255,184,56);
  724.     glVertex2f(decalb[0], decalb[1]);
  725.     glVertex2f(decalb[2], decalb[3]);
  726.     glVertex2f(decalb[4], decalb[5]);
  727.     glVertex2f(decalb[6], decalb[7]);
  728.     glEnd();
  729.    
  730.     glBegin(GL_QUADS);
  731.     glColor3ub(71,71,71);
  732.     glVertex2f(windowdecala[0], windowdecala[1]);
  733.     glVertex2f(windowdecala[2], windowdecala[3]);
  734.     glVertex2f(windowdecala[4], windowdecala[5]);
  735.     glVertex2f(windowdecala[6], windowdecala[7]);
  736.     glEnd();
  737.    
  738.     glBegin(GL_QUADS);
  739.     glColor3ub(71,71,71);
  740.     glVertex2f(windowdecalb[0], windowdecalb[1]);
  741.     glVertex2f(windowdecalb[2], windowdecalb[3]);
  742.     glVertex2f(windowdecalb[4], windowdecalb[5]);
  743.     glVertex2f(windowdecalb[6], windowdecalb[7]);
  744.     glEnd();
  745.    
  746.     glBegin(GL_QUADS);
  747.     glColor3ub(71,71,71);
  748.     glVertex2f(windowdecalc[0], windowdecalc[1]);
  749.     glVertex2f(windowdecalc[2], windowdecalc[3]);
  750.     glVertex2f(windowdecalc[4], windowdecalc[5]);
  751.     glVertex2f(windowdecalc[6], windowdecalc[7]);
  752.     glEnd();
  753.    
  754.     glBegin(GL_QUADS);
  755.     glColor3ub(232,232,232);
  756.     glVertex2f(roof[0], roof[1]);
  757.     glVertex2f(roof[2], roof[3]);
  758.     glVertex2f(roof[4], roof[5]);
  759.     glVertex2f(roof[6], roof[7]);
  760.     glEnd();
  761.    
  762.     glBegin(GL_QUADS);
  763.     glColor3ub(71,71,71);
  764.     glVertex2f(bumpera[0], bumpera[1]);
  765.     glVertex2f(bumpera[2], bumpera[3]);
  766.     glVertex2f(bumpera[4], bumpera[5]);
  767.     glVertex2f(bumpera[6], bumpera[7]);
  768.     glEnd();
  769.    
  770.     glBegin(GL_QUADS);
  771.     glColor3ub(71,71,71);
  772.     glVertex2f(bumperb[0], bumperb[1]);
  773.     glVertex2f(bumperb[2], bumperb[3]);
  774.     glVertex2f(bumperb[4], bumperb[5]);
  775.     glVertex2f(bumperb[6], bumperb[7]);
  776.     glEnd();
  777.    
  778.     glBegin(GL_QUADS);
  779.     glColor3ub(71,71,71);
  780.     glVertex2f(bumperc[0], bumperc[1]);
  781.     glVertex2f(bumperc[2], bumperc[3]);
  782.     glVertex2f(bumperc[4], bumperc[5]);
  783.     glVertex2f(bumperc[6], bumperc[7]);
  784.     glEnd();
  785.    
  786.     glBegin(GL_QUADS);
  787.     glColor3ub(255,255,255);
  788.     glVertex2f(bandepan[0], bandepan[1]);
  789.     glVertex2f(bandepan[2], bandepan[3]);
  790.     glVertex2f(bandepan[4], bandepan[5]);
  791.     glVertex2f(bandepan[6], bandepan[7]);
  792.     glEnd();
  793.    
  794.     glBegin(GL_QUADS);
  795.     glColor3ub(0,0,0);
  796.     glVertex2f(bandepana[0], bandepana[1]);
  797.     glVertex2f(bandepana[2], bandepana[3]);
  798.     glVertex2f(bandepana[4], bandepana[5]);
  799.     glVertex2f(bandepana[6], bandepana[7]);
  800.     glEnd();
  801.    
  802.     glBegin(GL_QUADS);
  803.     glColor3ub(0,0,0);
  804.     glVertex2f(bandepanb[0], bandepanb[1]);
  805.     glVertex2f(bandepanb[2], bandepanb[3]);
  806.     glVertex2f(bandepanb[4], bandepanb[5]);
  807.     glVertex2f(bandepanb[6], bandepanb[7]);
  808.     glEnd();
  809.    
  810.     glBegin(GL_QUADS);
  811.     glColor3ub(0,0,0);
  812.     glVertex2f(bandepanc[0], bandepanc[1]);
  813.     glVertex2f(bandepanc[2], bandepanc[3]);
  814.     glVertex2f(bandepanc[4], bandepanc[5]);
  815.     glVertex2f(bandepanc[6], bandepanc[7]);
  816.     glEnd();
  817.    
  818.     glBegin(GL_QUADS);
  819.     glColor3ub(0,0,0);
  820.     glVertex2f(bandepand[0], bandepand[1]);
  821.     glVertex2f(bandepand[2], bandepand[3]);
  822.     glVertex2f(bandepand[4], bandepand[5]);
  823.     glVertex2f(bandepand[6], bandepand[7]);
  824.     glEnd();
  825.    
  826.     glBegin(GL_TRIANGLES);
  827.     glColor3ub(0,0,0);
  828.     glVertex2f(bandepane[0], bandepane[1]);
  829.     glVertex2f(bandepane[2], bandepane[3]);
  830.     glVertex2f(bandepane[4], bandepane[5]);
  831.     glEnd();
  832.    
  833.     glBegin(GL_TRIANGLES);
  834.     glColor3ub(0,0,0);
  835.     glVertex2f(bandepanf[0], bandepanf[1]);
  836.     glVertex2f(bandepanf[2], bandepanf[3]);
  837.     glVertex2f(bandepanf[4], bandepanf[5]);
  838.     glEnd();
  839.    
  840.     glBegin(GL_TRIANGLES);
  841.     glColor3ub(0,0,0);
  842.     glVertex2f(bandepang[0], bandepang[1]);
  843.     glVertex2f(bandepang[2], bandepang[3]);
  844.     glVertex2f(bandepang[4], bandepang[5]);
  845.     glEnd();
  846.    
  847.     glBegin(GL_TRIANGLES);
  848.     glColor3ub(0,0,0);
  849.     glVertex2f(bandepanh[0], bandepanh[1]);
  850.     glVertex2f(bandepanh[2], bandepanh[3]);
  851.     glVertex2f(bandepanh[4], bandepanh[5]);
  852.     glEnd();
  853.    
  854.     glBegin(GL_QUADS);
  855.     glColor3ub(255,255,255);
  856.     glVertex2f(banbelakang[0], banbelakang[1]);
  857.     glVertex2f(banbelakang[2], banbelakang[3]);
  858.     glVertex2f(banbelakang[4], banbelakang[5]);
  859.     glVertex2f(banbelakang[6], banbelakang[7]);
  860.     glEnd();
  861.    
  862.     glBegin(GL_QUADS);
  863.     glColor3ub(0,0,0);
  864.     glVertex2f(banbelakanga[0], banbelakanga[1]);
  865.     glVertex2f(banbelakanga[2], banbelakanga[3]);
  866.     glVertex2f(banbelakanga[4], banbelakanga[5]);
  867.     glVertex2f(banbelakanga[6], banbelakanga[7]);
  868.     glEnd();
  869.    
  870.     glBegin(GL_QUADS);
  871.     glColor3ub(0,0,0);
  872.     glVertex2f(banbelakangb[0], banbelakangb[1]);
  873.     glVertex2f(banbelakangb[2], banbelakangb[3]);
  874.     glVertex2f(banbelakangb[4], banbelakangb[5]);
  875.     glVertex2f(banbelakangb[6], banbelakangb[7]);
  876.     glEnd();
  877.    
  878.     glBegin(GL_QUADS);
  879.     glColor3ub(0,0,0);
  880.     glVertex2f(banbelakangc[0], banbelakangc[1]);
  881.     glVertex2f(banbelakangc[2], banbelakangc[3]);
  882.     glVertex2f(banbelakangc[4], banbelakangc[5]);
  883.     glVertex2f(banbelakangc[6], banbelakangc[7]);
  884.     glEnd();
  885.    
  886.     glBegin(GL_QUADS);
  887.     glColor3ub(0,0,0);
  888.     glVertex2f(banbelakangd[0], banbelakangd[1]);
  889.     glVertex2f(banbelakangd[2], banbelakangd[3]);
  890.     glVertex2f(banbelakangd[4], banbelakangd[5]);
  891.     glVertex2f(banbelakangd[6], banbelakangd[7]);
  892.     glEnd();
  893.    
  894.     glBegin(GL_QUADS);
  895.     glColor3ub(0,0,0);
  896.     glVertex2f(banbelakange[0], banbelakange[1]);
  897.     glVertex2f(banbelakange[2], banbelakange[3]);
  898.     glVertex2f(banbelakange[4], banbelakange[5]);
  899.     glVertex2f(banbelakange[6], banbelakange[7]);
  900.     glEnd();
  901.    
  902.     glBegin(GL_QUADS);
  903.     glColor3ub(0,0,0);
  904.     glVertex2f(banbelakangf[0], banbelakangf[1]);
  905.     glVertex2f(banbelakangf[2], banbelakangf[3]);
  906.     glVertex2f(banbelakangf[4], banbelakangf[5]);
  907.     glVertex2f(banbelakangf[6], banbelakangf[7]);
  908.     glEnd();
  909.    
  910.     glBegin(GL_QUADS);
  911.     glColor3ub(0,0,0);
  912.     glVertex2f(banbelakangg[0], banbelakangg[1]);
  913.     glVertex2f(banbelakangg[2], banbelakangg[3]);
  914.     glVertex2f(banbelakangg[4], banbelakangg[5]);
  915.     glVertex2f(banbelakangg[6], banbelakangg[7]);
  916.     glEnd();
  917.    
  918.     glBegin(GL_QUADS);
  919.     glColor3ub(0,0,0);
  920.     glVertex2f(banbelakangh[0], banbelakangh[1]);
  921.     glVertex2f(banbelakangh[2], banbelakangh[3]);
  922.     glVertex2f(banbelakangh[4], banbelakangh[5]);
  923.     glVertex2f(banbelakangh[6], banbelakangh[7]);
  924.     glEnd();
  925.    
  926. }
  927.  
  928. void init()
  929. {
  930.     glClearColor(1,1,0.0,0.0);
  931.     glMatrixMode(GL_PROJECTION);
  932.     glLoadIdentity();
  933.     glMatrixMode(GL_MODELVIEW);
  934.     gluOrtho2D(ortho[0],ortho[1],ortho[2],ortho[3]);
  935. }
  936.  
  937.  
  938. void timer(int a)
  939. {
  940.     if(geraka==1){
  941.         agerak[1] += 0.5;
  942.         if(agerak[1] == stage_batas_atas[1]+2){
  943.             geraka=2;
  944.         }
  945.     }
  946.     else if(geraka==2){
  947.         agerak[1] -=0.5;
  948.         if(agerak[1] == stage_batas_bawah[1]+4){
  949.             geraka=1;
  950.         }
  951.     }
  952.    
  953.     if(gerakb==1){
  954.         bgerak[1] +=0.5;
  955.         if(bgerak[1] == stage_batas_atas[1]+2){
  956.             gerakb=2;
  957.         }
  958.     }
  959.     else if(gerakb==2){
  960.         bgerak[1] -=0.5;
  961.         if(bgerak[1] == stage_batas_bawah[1]+4){
  962.             gerakb=1;
  963.         }
  964.     }
  965.    
  966.     timerandom +=0.5;
  967.    
  968.     if(timerandom>10){
  969.         timerandom = -30;
  970.     }
  971.    
  972.     if(agerak[1]==stage_batas_atas[0]){
  973.         agerak[1] -= 0.5;
  974.     }
  975.    
  976.     glutPostRedisplay();
  977.     glutTimerFunc(1000/60, timer , 0);
  978. }
  979.  
  980.  
  981. void Levelone()
  982. {
  983.     glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  984.    
  985.     glPushMatrix();
  986.     background();
  987.     glPopMatrix();
  988.    
  989.     glPushMatrix();
  990.     mobil2();
  991.     glPopMatrix();
  992.    
  993.     glPushMatrix();
  994.     mobil1();
  995.     glPopMatrix();
  996.    
  997.    
  998.     glFlush();
  999. }
  1000.  
  1001. void keyboard(unsigned char key,int x,int y)
  1002. {
  1003.     switch(key){
  1004.         case 'w':
  1005.             geraka = 1;
  1006.             break;
  1007.         case 's':
  1008.             geraka = 2;
  1009.             break;
  1010.         case 'i':
  1011.             gerakb = 1;
  1012.             break;
  1013.         case 'k':
  1014.             gerakb = 2;
  1015.             break;
  1016.            
  1017.         default:
  1018.             break;
  1019.     }
  1020. }
  1021.  
  1022. int main(int argc, char *argv[])
  1023. {
  1024.     glutInit(&argc, argv);
  1025.     glutInitWindowSize(640,480);
  1026.     glutInitWindowPosition(3,50);
  1027.     glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);
  1028.     glutCreateWindow("GLUT Shapes");
  1029.     glClearColor(1,1,1,1);
  1030.     init();
  1031.     glutDisplayFunc(Levelone);
  1032.     glutKeyboardFunc(keyboard);
  1033.     glutTimerFunc(50, timer,0);
  1034.     glutMainLoop();
  1035.    
  1036.     return EXIT_SUCCESS;
  1037. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top