Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 KB | None | 0 0
  1. void proec()
  2. {
  3. if (k1 == 0) {
  4. glClearColor(0, 0, 0, 1.0);
  5. glMatrixMode(GL_PROJECTION);
  6. glLoadIdentity();
  7. glOrtho(-150, 150, -150+60, 150+60, -150, 150);
  8.  
  9. //k1++;
  10. }
  11.  
  12.  
  13.  
  14.  
  15.  
  16. glClear(GL_COLOR_BUFFER_BIT);
  17. glPushMatrix();
  18. //glPushMatrix();
  19. //glRot
  20. //glRotated(5, 1, 0, 0);
  21. glRotated(degree, 0, 1, 0);
  22. //glRotated(alpha, 0, -1, 0);
  23.  
  24. //alpha = 0;
  25.  
  26.  
  27. //glBegin(GL_LINE_STRIP);
  28. glBegin(GL_LINES);
  29. //if (degree >= 0 && degree < 90 || degree > 270 && degree < 360)
  30. //{
  31.  
  32. // glColor3f(0.5, 0.5, 0.5);
  33. //}
  34. //else if (degree >= 90 && degree <= 270)
  35.  
  36. glColor3f(1.0, 0.0, 0.0);
  37.  
  38. glVertex3f(-50, -50 + 150, -50 );
  39. glVertex3f(50, -50 + 150, -50);
  40.  
  41. if (degree > 0 && degree <90)
  42. {
  43. /*if (degree == 180)
  44. glColor3f(1.0, 0.0, 0.0);
  45. else*/
  46. glColor3f(0.5, 0.5, 0.5);
  47.  
  48. }
  49. else
  50. glColor3f(1.0, 0.0, 0.0);
  51.  
  52.  
  53. glVertex3f(50, -50 + 150, -50);
  54. glVertex3f(50, 50 + 150, -50);
  55.  
  56. /*if (degree > 0 && degree < 90 || degree > 270 && degree < 360)
  57. {
  58. if (degree == 180)
  59. glColor3f(1.0, 0.0, 0.0);
  60. else
  61. glColor3f(0.5, 0.5, 0.5);
  62. }
  63. else if (degree >= 90 && degree <= 270)*/
  64. glColor3f(1.0, 0.0, 0.0);
  65.  
  66. glVertex3f(50, 50 + 150, -50);
  67. glVertex3f(-50, 50 + 150, -50);
  68.  
  69. if (degree > 270 && degree < 360)
  70. {
  71.  
  72. glColor3f(0.5, 0.5, 0.5);
  73. }
  74. else
  75. glColor3f(1.0, 0.0, 0.0);
  76.  
  77. glVertex3f(-50, 50 + 150, -50);
  78. glVertex3f(-50, -50 + 150, -50);
  79. //glEnd();
  80.  
  81.  
  82.  
  83.  
  84. //glBegin(GL_LINE_STRIP);
  85. ////glBegin(GL_LINES);
  86. //if (degree >= 270 && degree < 360 || degree >= 0 && degree <= 90)
  87. //{
  88. glColor3f(1.0, 0.0, 0.0);
  89. //}
  90. //else
  91. // glColor3f(0.5, 0.5, 0.5);
  92.  
  93. glVertex3f(-50, -50 + 150, 50);
  94. glVertex3f(50, -50 + 150, 50);
  95.  
  96.  
  97. if (degree >90 && degree < 180)
  98. {
  99. glColor3f(0.5, 0.5, 0.5);
  100.  
  101. }
  102. else
  103. glColor3f(1.0, 0.0, 0.0);
  104. glVertex3f(50, -50 + 150, 50);
  105. glVertex3f(50, 50 + 150, 50);
  106.  
  107.  
  108. /*if (degree >=0 && degree <= 90 || degree >= 270 && degree <= 360)
  109. {
  110. glColor3f(1.0, 0.0, 0.0);
  111. }
  112. else if (degree > 90 && degree < 270)
  113. if (degree == 180)*/
  114. glColor3f(1.0, 0.0, 0.0);
  115. /*else
  116. glColor3f(0.5, 0.5, 0.5);*/
  117. glVertex3f(50, 50 + 150, 50);
  118. glVertex3f(-50, 50 + 150, 50);
  119.  
  120.  
  121. if (degree > 180 && degree < 270)
  122. {
  123. glColor3f(0.5, 0.5, 0.5);
  124. }
  125. else glColor3f(1.0, 0.0, 0.0);
  126.  
  127. glVertex3f(-50, 50 + 150, 50);
  128. glVertex3f(-50, -50 + 150, 50);
  129. //glEnd();
  130.  
  131. //glBegin(GL_LINE_STRIP);
  132. ////glBegin(GL_LINES);
  133. //glColor3f(1.0, 0.0, 0.0);
  134.  
  135.  
  136.  
  137.  
  138. //glBegin(GL_LINES);
  139. /*if (degree > 0 && degree < 180)
  140. {
  141. glColor3f(0.5, 0.5, 0.5);
  142. }
  143. else*/
  144. glColor3f(1.0, 0.0, 0.0);
  145.  
  146. glVertex3f(-50, -50 + 150, 50);
  147. glVertex3f(-50, -50 + 150, -50);
  148.  
  149.  
  150. /*if (degree >= 0 && degree <= 180)
  151. {*/
  152. glColor3f(1.0, 0.0, 0.0);
  153. /*}
  154. else glColor3f(0.5, 0.5, 0.5);*/
  155.  
  156. glVertex3f(50, -50 + 150, 50);
  157. glVertex3f(50, -50 + 150, -50);
  158.  
  159. glColor3f(1.0, 0.0, 0.0);
  160.  
  161. glVertex3f(50, 50 + 150, 50);
  162. glVertex3f(50, 50 + 150, -50);
  163.  
  164. glColor3f(1.0, 0.0, 0.0);
  165.  
  166. glVertex3f(-50, 50 + 150, 50);
  167. glVertex3f(-50, 50 + 150, -50);
  168. glEnd();
  169. //glFlush();
  170. //glPopMatrix();
  171.  
  172.  
  173.  
  174. //////////////////////////////////////////////////////////////////////////////////////////////////
  175.  
  176.  
  177. //glClear(GL_COLOR_BUFFER_BIT);
  178. // glPushMatrix();
  179.  
  180. /*if (k2 == 0)
  181. {
  182. glRotated(degree, 0, -1, 0);
  183. glRotated(55, 1, 0, 0);
  184. glRotated(degree, 0, 1, 0);
  185. k2++;
  186. }*/
  187.  
  188.  
  189. glRotated(degree, 0, -1, 0);
  190. // glRotated(alpha, 0, 1, 0);
  191. glRotated(90, 1, 0, 0);
  192. glRotated(degree, 0, 1, 0);
  193. //glRotated(alpha, 0, -1, 0);
  194. /*glRotated(alpha, 0, 1, 0);
  195. glRotated(55, 1, 0, 0);*/
  196.  
  197. //glRotated(alpha, 0, -1, 0);
  198. glRotated(beta, -1, 0, 0);
  199. glRotated(gamma, 0, 0, 1);
  200. glBegin(GL_LINES);
  201.  
  202. if (degree >= 0 && degree < 90 || degree > 270 && degree < 360)
  203. {
  204.  
  205. glColor3f(0.5, 0.5, 0.5);
  206. }
  207. else if (degree >= 90 && degree <= 270)
  208.  
  209. glColor3f(1.0, 0.0, 0.0);
  210.  
  211. glVertex3f(-50 , -50 , -50 );
  212. glVertex3f(50, -50, -50 );
  213.  
  214. if (degree >= 0 && degree <= 270)
  215. {
  216. /*if (degree == 180)
  217. glColor3f(1.0, 0.0, 0.0);
  218. else*/
  219. glColor3f(1.0, 0.0, 0.0);
  220.  
  221. }
  222. else if (degree > 270 && degree < 360)
  223. glColor3f(0.5, 0.5, 0.5);
  224.  
  225. glVertex3f(50, -50, -50);
  226. glVertex3f(50, 50 , -50);
  227.  
  228. /*if (degree > 0 && degree < 90 || degree > 270 && degree < 360)
  229. {
  230. if (degree == 180)
  231. glColor3f(1.0, 0.0, 0.0);
  232. else
  233. glColor3f(0.5, 0.5, 0.5);
  234. }
  235. else if (degree >= 90 && degree <= 270)*/
  236. glColor3f(1.0, 0.0, 0.0);
  237.  
  238. glVertex3f(50, 50, -50);
  239. glVertex3f(-50, 50, -50);
  240.  
  241. if (degree > 0 && degree < 90)
  242. {
  243.  
  244. glColor3f(0.5, 0.5, 0.5);
  245. }
  246. else
  247. glColor3f(1.0, 0.0, 0.0);
  248.  
  249. glVertex3f(-50, 50 , -50);
  250. glVertex3f(-50, -50, -50);
  251. //glEnd();
  252.  
  253.  
  254.  
  255.  
  256. //glBegin(GL_LINE_STRIP);
  257. //glBegin(GL_LINES);
  258. if (degree >= 270 && degree < 360 || degree >= 0 && degree <= 90)
  259. {
  260. glColor3f(1.0, 0.0, 0.0);
  261. }
  262. else
  263. glColor3f(0.5, 0.5, 0.5);
  264.  
  265. glVertex3f(-50, -50, 50);
  266. glVertex3f(50, -50, 50);
  267.  
  268.  
  269. if (degree >= 270 && degree < 360 || degree >= 0 && degree <= 180)
  270. {
  271. glColor3f(1.0, 0.0, 0.0);
  272. }
  273. else
  274. glColor3f(0.5, 0.5, 0.5);
  275. glVertex3f(50, -50 , 50);
  276. glVertex3f(50, 50 , 50);
  277.  
  278.  
  279. /*if (degree >=0 && degree <= 90 || degree >= 270 && degree <= 360)
  280. {
  281. glColor3f(1.0, 0.0, 0.0);
  282. }
  283. else if (degree > 90 && degree < 270)
  284. if (degree == 180)*/
  285. glColor3f(1.0, 0.0, 0.0);
  286. /*else
  287. glColor3f(0.5, 0.5, 0.5);*/
  288. glVertex3f(50, 50, 50);
  289. glVertex3f(-50, 50, 50);
  290.  
  291.  
  292. if (degree > 90 && degree < 180)
  293. {
  294. glColor3f(0.5, 0.5, 0.5);
  295. }
  296. else glColor3f(1.0, 0.0, 0.0);
  297.  
  298. glVertex3f(-50, 50 , 50);
  299. glVertex3f(-50, -50 , 50);
  300. //glEnd();
  301.  
  302. //glBegin(GL_LINE_STRIP);
  303. ////glBegin(GL_LINES);
  304. //glColor3f(1.0, 0.0, 0.0);
  305.  
  306.  
  307.  
  308.  
  309. // glBegin(GL_LINES);
  310. if (degree > 0 && degree < 180)
  311. {
  312. glColor3f(0.5, 0.5, 0.5);
  313. }
  314. else
  315. glColor3f(1.0, 0.0, 0.0);
  316.  
  317. glVertex3f(-50, -50 , 50);
  318. glVertex3f(-50, -50 , -50);
  319.  
  320.  
  321. if (degree >= 0 && degree <= 180)
  322. {
  323. glColor3f(1.0, 0.0, 0.0);
  324. }
  325. else glColor3f(0.5, 0.5, 0.5);
  326.  
  327. glVertex3f(50, -50 , 50);
  328. glVertex3f(50, -50 , -50);
  329.  
  330. glColor3f(1.0, 0.0, 0.0);
  331.  
  332. glVertex3f(50, 50 , 50);
  333. glVertex3f(50, 50, -50);
  334.  
  335. glColor3f(1.0, 0.0, 0.0);
  336.  
  337. glVertex3f(-50, 50 , 50);
  338. glVertex3f(-50, 50, -50);
  339. glEnd();
  340. glFlush();
  341. //glPopMatrix();
  342. // glRotated(55, -1, 0, 0);
  343. glPopMatrix();
  344. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement