fork download
  1.  
  2. #define _USE_MATH_DEFINES
  3. #include <cmath>
  4.  
  5.  
  6.  
  7. /* Global variables */
  8. char title[] = "Animal Farm - Final Project";
  9. GLsizei winWidth = 800, winHeight = 600;
  10.  
  11. // Angle for animation
  12. int font = (int)GLUT_BITMAP_8_BY_13;
  13. GLfloat M = 100.0; // mass
  14. GLfloat T = 0.00; // time
  15. GLfloat skyColor = 1.0;
  16. GLfloat sunColor = 0.0;
  17. GLfloat sunPos = 2.0;
  18. GLfloat sheepHead = 0.5;
  19. GLfloat sheepHeadRot = 0.0;
  20. GLboolean sheepHeadDown = false;
  21. GLfloat pigHead = 0.5;
  22. GLboolean pigHeadDown = false;
  23.  
  24. GLfloat rainPos = 0.5;
  25.  
  26. /* Initialize OpenGL Graphics */
  27. void init() {
  28. // Get and display your OpenGL version
  29. const GLubyte *Vstr;
  30. Vstr = glGetString(GL_VERSION);
  31. fprintf(stderr, "Your OpenGL version is %s\n", Vstr);
  32.  
  33. // Set background color to blue
  34. glClearColor(0.0f, 0.0f, skyColor, 0.0f);
  35. // Maximize depth display
  36. glClearDepth(1.0f);
  37. // Enable depth testing for z-culling
  38. glEnable(GL_DEPTH_TEST);
  39. // Set the type of depth-test
  40. glDepthFunc(GL_LEQUAL);
  41. // Provide smooth shading
  42.  
  43. }
  44.  
  45. // convenience function for displaying strings
  46. void renderBitmapString(float x, float y, void *font, char *string)
  47. {
  48. char *c;
  49. glRasterPos3f(x, y, -7.0);
  50. for (c = string; *c != '\0'; c++) {
  51. glutBitmapCharacter(font, *c);
  52. }
  53. }
  54.  
  55. void animateAll(void)
  56. {
  57. Sleep(WAITMS);
  58.  
  59. if (skyColor <= 0.0){
  60. // controls the specular color
  61. GLfloat mat_specular[] = { 0.5, 0.5, 0.5, 1.0 };
  62. GLfloat mat_shininess[] = { 100.0 };
  63. GLfloat light_position[] = { 4.0, sunPos, -4.0, 0.0 };
  64. // Apply the specular color to the front.
  65. glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
  66. // Apply the shininess to the front.
  67. glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
  68. // Apply the first light (Light0) at the assigned position
  69. glLightfv(GL_LIGHT0, GL_POSITION, light_position);
  70. // Enable lighting and Depth perception
  71. glEnable(GL_LIGHTING);
  72. glEnable(GL_LIGHT0);
  73. }
  74. else
  75. glDisable(GL_LIGHTING);
  76.  
  77.  
  78. //Rain movement
  79. GLfloat accel = 9.8 * M * pow(T, 2.0);
  80. if (T < 0.03){
  81. T += 0.001;
  82. }
  83. rainPos -= accel;
  84. if (rainPos < -4.0){
  85. T = 0.0;
  86. rainPos = 0.5;
  87. }
  88.  
  89. //Sheep movement
  90. if (sheepHeadDown == false){
  91. if (sheepHead == 0.5 && sheepHeadRot > -50.0){
  92. sheepHeadRot -= 1.0;
  93. }
  94. else if (sheepHeadRot == -50.0 & sheepHead > -0.3){
  95. sheepHead -= 0.01;
  96. }
  97. else{
  98. sheepHeadDown = true;
  99. }
  100. }
  101. else if (sheepHeadDown == true){
  102. if (sheepHead < 0.5){
  103. sheepHead += 0.01;
  104. }
  105. else if (sheepHead == 0.5 && sheepHeadRot < 0.0){
  106. sheepHeadRot += 1.0;
  107. }
  108. else
  109. sheepHeadDown = false;
  110. }
  111. //Pig movement
  112. if (pigHeadDown == false){
  113. if (pigHead > -0.3){
  114. pigHead -= 0.01;
  115. }
  116. else{
  117. pigHeadDown = true;
  118. }
  119. }
  120. else if (pigHeadDown == true){
  121. if (pigHead < 0.5){
  122. pigHead += 0.01;
  123. }
  124. else
  125. pigHeadDown = false;
  126. }
  127. //Sun movement
  128. if (sunPos > 0.0){
  129. sunPos -= 0.01;
  130. }
  131. if (sunPos <= 0.0 && sunPos > -2.2){
  132. sunPos -= 0.01;
  133. if (skyColor > 0.0){
  134. skyColor -= 0.005;
  135. }
  136. glClearColor(0.0f, 0.0f, skyColor, 0.0f);
  137. }
  138. if (sunPos <= -2.2 && sunColor == 0.0){
  139. sunPos = 6.0;
  140. sunColor = 1.0;
  141. }
  142. else if (sunPos <= -2.2 && sunColor == 1.0){
  143. sunPos = 6.0;
  144. sunColor = 0.0;
  145. }
  146. if (sunPos > 4.0 && sunColor == 0.0 && skyColor < 1.0){
  147. skyColor += 0.005;
  148. glClearColor(0.0f, 0.0f, skyColor, 0.0f);
  149. }
  150.  
  151. glutPostRedisplay();
  152. }
  153.  
  154. void sheep(GLdouble x, GLdouble y, GLdouble z){
  155. // Body
  156. glColor3f(1.0, 1.0, 1.0);
  157. glLoadIdentity();
  158. glTranslatef(x,y,z);
  159. glScalef(1.0f, 0.5f, 0.5f);
  160. glutSolidSphere(0.75, 15, 15);
  161.  
  162. // Head
  163. glColor3f(0.7, 0.7, 0.7);
  164. glTranslatef(0.7f, sheepHead, 0.0f);
  165. glRotatef(sheepHeadRot, 0.0f, 0.0f, 1.0f);
  166. glScalef(0.5f, 0.3f, 0.3f);
  167. glutSolidSphere(0.75, 15, 15);
  168.  
  169. //Legs
  170. glLoadIdentity();
  171. glTranslatef(-1.15, -0.7, -7.0f);
  172. glScalef(1.0f, 0.5f, 0.5f);
  173. glTranslatef(0.5f, 0.5, 0.0f);
  174. glScalef(0.5f, 0.3f, 0.3f);
  175. glColor3f(0.7, 0.7, 0.7);
  176. glTranslatef(-2.0f, -4.0, 1.0f);
  177. glScalef(0.3f, 4.0f, 1.0f);
  178. glutSolidCube(1.0);
  179. glTranslatef(1.5f, 0.0f, -1.0f);
  180. glutSolidCube(1.0);
  181. glTranslatef(5.0f, 0.0f, 0.0f);
  182. glutSolidCube(1.0);
  183. glTranslatef(-1.5f, 0.0f, 1.0f);
  184. glutSolidCube(1.0);
  185. }
  186.  
  187. void pig(GLdouble x, GLdouble y, GLdouble z){
  188. // Body
  189. glColor3f(1.0, 0.3, 0.3);
  190. glLoadIdentity();
  191. glTranslatef(x, y, z);
  192. glScalef(1.0f, 0.5f, 0.5f);
  193. glutSolidSphere(0.75, 15, 15);
  194.  
  195. // Head
  196. glTranslatef(-0.7f, pigHead, 0.0f);
  197. glColor3f(0.7, 0.0, 0.0);
  198. glScalef(0.3f, 0.6f, 0.6f);
  199. glutSolidSphere(0.75, 15, 15);
  200.  
  201. //Legs
  202. glLoadIdentity();
  203. glTranslatef(x, y, z);
  204. glScalef(1.0f, 0.5f, 0.5f);
  205. glTranslatef(-0.7f, 0.5, 0.0f);
  206. glScalef(0.3f, 0.6f, 0.6f);
  207.  
  208. glTranslatef(0.5f, -2.0, 1.0f);
  209. glScalef(0.3f, 2.0f, 1.0f);
  210. glutSolidCube(1.0);
  211. glTranslatef(1.5f, 0.0f, -1.0f);
  212. glutSolidCube(1.0);
  213. glTranslatef(10.0f, 0.0f, 0.0f);
  214. glutSolidCube(1.0);
  215. glTranslatef(-1.5f, 0.0f, 1.0f);
  216. glutSolidCube(1.0);
  217. }
  218.  
  219. void triangle(double x, double y, double z){
  220. glLoadIdentity();
  221. glTranslatef(x, y, z);
  222. glColor3f(0.0, 1.0, 0.0);
  223. glScalef(0.1f, 0.1f, 0.1f);
  224. glBegin(GL_POLYGON);
  225. glVertex2i(0.0, 0.0);
  226. glVertex2i(2.0, -2.0);
  227. glVertex2i(-2.0, -2.0);
  228. glEnd();
  229. }
  230.  
  231. void grass(){
  232. for (double i = -5; i < 5; i += .1){
  233. glLoadIdentity();
  234. triangle(i, -1.0, -9.0);
  235. }
  236. for (double i = -5; i < 5; i += .1){
  237. glLoadIdentity();
  238. triangle(i, -1.0, -7.9);
  239. }
  240. for (double i = -5; i < 5; i += .1){
  241. glLoadIdentity();
  242. triangle(i, -1.0, -7.0);
  243. }
  244. for (double i = -5; i < 5; i += .1){
  245. glLoadIdentity();
  246. triangle(i, -1.0, -6.0);
  247. }
  248. for (double i = -5; i < 5; i += .1){
  249. glLoadIdentity();
  250. triangle(i, -1.0, -5.0);
  251. }
  252. for (double i = -5; i < 5; i += .1){
  253. glLoadIdentity();
  254. triangle(i, -1.0, -4.0);
  255. }
  256. for (double i = -5; i < 5; i += .1){
  257. glLoadIdentity();
  258. triangle(i, -1.0, -3.5);
  259. }
  260. for (double i = -5; i < 5; i += .1){
  261. glLoadIdentity();
  262. triangle(i, -1.0, -3.0);
  263. }
  264. }
  265.  
  266. void clouds(){
  267. // Head
  268. glTranslatef(-2.0f, 1.0, -8.0f);
  269. glColor3f(0.5, 0.5, 0.5);
  270. glutSolidSphere(0.25, 15, 15);
  271. glTranslatef(-0.25f, 0.25, 0.0f);
  272. glutSolidSphere(0.25, 15, 15);
  273. glTranslatef(-0.25f, -0.25, 0.0f);
  274. glutSolidSphere(0.25, 15, 15);
  275. glTranslatef(-0.25f, 0.25, 0.0f);
  276. glutSolidSphere(0.25, 15, 15);
  277. glTranslatef(-0.25f, -0.25, 0.0f);
  278. glutSolidSphere(0.25, 15, 15);
  279. glTranslatef(-0.25f, 0.25, 0.0f);
  280. glutSolidSphere(0.25, 15, 15);
  281. glTranslatef(-0.25f, -0.25, 0.0f);
  282. glutSolidSphere(0.25, 15, 15);
  283. }
  284.  
  285. void rainDrop(){
  286. glColor3f(0.0, 1.0, 1.0);
  287. GLubyte bitShape2[72] = {
  288. 0x01, 0xFF, 0x80,
  289. 0x03, 0xFF, 0xC0,
  290. 0x07, 0xFF, 0xE0,
  291. 0x0F, 0xFF, 0xF0,
  292. 0x1F, 0xFF, 0xF8,
  293. 0x3F, 0xFF, 0xFC,
  294. 0x3F, 0xFF, 0xFC,
  295. 0x7F, 0xFF, 0xFE,
  296. 0x7F, 0xFF, 0xFE,
  297. 0x7F, 0xFF, 0xFE,
  298. 0x3F, 0xFF, 0xFC,
  299. 0x3F, 0xFF, 0xFC,
  300. 0x1F, 0xFF, 0xF8,
  301. 0x0F, 0xFF, 0xF0,
  302. 0x07, 0xFF, 0xE0,
  303. 0x03, 0xFF, 0xC0,
  304. 0x01, 0xFF, 0x80,
  305. 0x00, 0xFF, 0x00,
  306. 0x00, 0x7E, 0x00,
  307. 0x00, 0x7E, 0x00,
  308. 0x00, 0x3C, 0x00,
  309. 0x00, 0x3C, 0x00,
  310. 0x00, 0x18, 0x00,
  311. 0x00, 0x18, 0x00,
  312. };
  313. glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  314.  
  315. glTranslatef(-0.1f, rainPos, -9.0f);
  316. glRasterPos2i(-4.0, 0.0);
  317.  
  318. glBitmap(24.0, 24.0, 0.0, 0.0, 36.0, 0.0, bitShape2);
  319. glBitmap(24.0, 24.0, 0.0, 0.0, 36.0, 24.0, bitShape2);
  320. glBitmap(24.0, 24.0, 0.0, 0.0, 36.0, -24.0, bitShape2);
  321. glBitmap(24.0, 24.0, 0.0, 0.0, 36.0, 24.0, bitShape2);
  322. glBitmap(24.0, 24.0, 0.0, 0.0, 36.0, -24.0, bitShape2);
  323. glFlush();
  324. }
  325.  
  326. void Menu(void){
  327. // Directions
  328. glColor3f(1.0f, 1.0f, 0.0f);
  329. renderBitmapString(-0.8, 2.7, (void *)font, "Press \"a\" to start animation.");
  330. renderBitmapString(-0.8, 2.4, (void *)font, "Press \"s\" to pause animation.");
  331. }
  332. // Display Function
  333. void displayMain() {
  334. // Clear color and depth buffers
  335. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  336.  
  337. // Model view matrix mode
  338. glMatrixMode(GL_MODELVIEW);
  339.  
  340. glLoadIdentity();
  341. sheep(-1.15, -0.7, -7.0f);
  342. pig(3.0f, -0.7f, -7.0f);
  343. grass();
  344.  
  345. //Ground
  346. glLoadIdentity();
  347. glTranslatef(0.0, 0.0, -8.0);
  348. glColor3f(0.5, 0.5, 0.0);
  349. glRecti(-5.0, -5.0, 5.0, -1.99999);
  350.  
  351. //Sun
  352. glLoadIdentity();
  353. glTranslatef(2.0, sunPos, -10.0);
  354. glColor3f(1.0, 1.0, sunColor);
  355. glutSolidSphere(1.0,15,15);
  356.  
  357. //Clouds
  358. glLoadIdentity();
  359. clouds();
  360.  
  361. //Rain Drop
  362. glLoadIdentity();
  363. rainDrop();
  364.  
  365. //Message
  366. glLoadIdentity();
  367. glTranslatef(-3.0, 0.0, -5.0);
  368. Menu();
  369.  
  370. // Double buffering
  371. glutSwapBuffers();
  372. }
  373.  
  374. void keyboard(unsigned char key, int x, int y)
  375. {
  376. switch (key) {
  377. case 'a':
  378. //All
  379. glutIdleFunc(animateAll);
  380. break;
  381. case 's':
  382. // stop all
  383. glutIdleFunc(NULL);
  384. break;
  385. default:
  386. break;
  387. }
  388. }
  389.  
  390. // Windows redraw function
  391. void winReshapeFcn(GLsizei width, GLsizei height) {
  392. // Compute aspect ratio of the new window
  393. if (height == 0)
  394. height = 1;
  395. GLfloat aspect = (GLfloat)width / (GLfloat)height;
  396.  
  397. // Set the viewport
  398. // Allows for resizing without major display issues
  399. glViewport(0, 0, width, height);
  400.  
  401. // Set the aspect ratio of the clipping volume to match the viewport
  402. glMatrixMode(GL_PROJECTION);
  403. glLoadIdentity();
  404. // Enable perspective projection with fovy, aspect, zNear and zFar
  405. // This is the camera view and objects align with view frustum
  406. gluPerspective(45.0f, aspect, 0.1f, 100.0f);
  407. }
  408.  
  409. /* Main function: GLUT runs as a console application starting at main() */
  410. void main(int argc, char** argv) {
  411. glutInit(&argc, argv);
  412. glutInitDisplayMode(GLUT_DOUBLE);
  413. // Set the window's initial width & height
  414. glutInitWindowSize(winWidth, winHeight);
  415. // Position the window's initial top-left corner
  416. glutInitWindowPosition(50, 50);
  417. // Create window with the given title
  418. glutCreateWindow(title);
  419. // Display Function
  420. glutDisplayFunc(displayMain);
  421. // Reshape function
  422. glutReshapeFunc(winReshapeFcn);
  423. // Initialize
  424. init();
  425.  
  426. // Keyboard functions
  427. glutKeyboardFunc(keyboard);
  428.  
  429. // Process Loop
  430. glutMainLoop();
  431. }
  432.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:9:1: error: 'GLsizei' does not name a type
 GLsizei winWidth = 800, winHeight = 600;
 ^
prog.cpp:12:17: error: 'GLUT_BITMAP_8_BY_13' was not declared in this scope
 int font = (int)GLUT_BITMAP_8_BY_13;
                 ^
prog.cpp:13:1: error: 'GLfloat' does not name a type
 GLfloat M = 100.0; // mass
 ^
prog.cpp:14:1: error: 'GLfloat' does not name a type
 GLfloat T = 0.00; // time
 ^
prog.cpp:15:1: error: 'GLfloat' does not name a type
 GLfloat skyColor = 1.0;
 ^
prog.cpp:16:1: error: 'GLfloat' does not name a type
 GLfloat sunColor = 0.0;
 ^
prog.cpp:17:1: error: 'GLfloat' does not name a type
 GLfloat sunPos = 2.0;
 ^
prog.cpp:18:1: error: 'GLfloat' does not name a type
 GLfloat sheepHead = 0.5;
 ^
prog.cpp:19:1: error: 'GLfloat' does not name a type
 GLfloat sheepHeadRot = 0.0;
 ^
prog.cpp:20:1: error: 'GLboolean' does not name a type
 GLboolean sheepHeadDown = false;
 ^
prog.cpp:21:1: error: 'GLfloat' does not name a type
 GLfloat pigHead = 0.5;
 ^
prog.cpp:22:1: error: 'GLboolean' does not name a type
 GLboolean pigHeadDown = false;
 ^
prog.cpp:24:1: error: 'GLfloat' does not name a type
 GLfloat rainPos = 0.5;
 ^
prog.cpp: In function 'void init()':
prog.cpp:29:8: error: 'GLubyte' does not name a type
  const GLubyte *Vstr;
        ^
prog.cpp:30:2: error: 'Vstr' was not declared in this scope
  Vstr = glGetString(GL_VERSION);
  ^
prog.cpp:30:21: error: 'GL_VERSION' was not declared in this scope
  Vstr = glGetString(GL_VERSION);
                     ^
prog.cpp:30:31: error: 'glGetString' was not declared in this scope
  Vstr = glGetString(GL_VERSION);
                               ^
prog.cpp:31:10: error: 'stderr' was not declared in this scope
  fprintf(stderr, "Your OpenGL version is %s\n", Vstr); 
          ^
prog.cpp:31:53: error: 'fprintf' was not declared in this scope
  fprintf(stderr, "Your OpenGL version is %s\n", Vstr); 
                                                     ^
prog.cpp:34:27: error: 'skyColor' was not declared in this scope
  glClearColor(0.0f, 0.0f, skyColor, 0.0f);
                           ^
prog.cpp:34:41: error: 'glClearColor' was not declared in this scope
  glClearColor(0.0f, 0.0f, skyColor, 0.0f);
                                         ^
prog.cpp:36:19: error: 'glClearDepth' was not declared in this scope
  glClearDepth(1.0f);
                   ^
prog.cpp:38:11: error: 'GL_DEPTH_TEST' was not declared in this scope
  glEnable(GL_DEPTH_TEST);
           ^
prog.cpp:38:24: error: 'glEnable' was not declared in this scope
  glEnable(GL_DEPTH_TEST);
                        ^
prog.cpp:40:14: error: 'GL_LEQUAL' was not declared in this scope
  glDepthFunc(GL_LEQUAL);
              ^
prog.cpp:40:23: error: 'glDepthFunc' was not declared in this scope
  glDepthFunc(GL_LEQUAL);
                       ^
prog.cpp: In function 'void renderBitmapString(float, float, void*, char*)':
prog.cpp:49:26: error: 'glRasterPos3f' was not declared in this scope
  glRasterPos3f(x, y, -7.0);
                          ^
prog.cpp:51:31: error: 'glutBitmapCharacter' was not declared in this scope
   glutBitmapCharacter(font, *c);
                               ^
prog.cpp: In function 'void animateAll()':
prog.cpp:57:8: error: 'WAITMS' was not declared in this scope
  Sleep(WAITMS);
        ^
prog.cpp:57:14: error: 'Sleep' was not declared in this scope
  Sleep(WAITMS);
              ^
prog.cpp:59:6: error: 'skyColor' was not declared in this scope
  if (skyColor <= 0.0){
      ^
prog.cpp:61:3: error: 'GLfloat' was not declared in this scope
   GLfloat mat_specular[] = { 0.5, 0.5, 0.5, 1.0 };
   ^
prog.cpp:62:11: error: expected ';' before 'mat_shininess'
   GLfloat mat_shininess[] = { 100.0 };
           ^
prog.cpp:63:11: error: expected ';' before 'light_position'
   GLfloat light_position[] = { 4.0, sunPos, -4.0, 0.0 };
           ^
prog.cpp:65:16: error: 'GL_FRONT' was not declared in this scope
   glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
                ^
prog.cpp:65:26: error: 'GL_SPECULAR' was not declared in this scope
   glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
                          ^
prog.cpp:65:39: error: 'mat_specular' was not declared in this scope
   glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
                                       ^
prog.cpp:65:51: error: 'glMaterialfv' was not declared in this scope
   glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
                                                   ^
prog.cpp:67:26: error: 'GL_SHININESS' was not declared in this scope
   glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
                          ^
prog.cpp:67:40: error: 'mat_shininess' was not declared in this scope
   glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
                                        ^
prog.cpp:69:13: error: 'GL_LIGHT0' was not declared in this scope
   glLightfv(GL_LIGHT0, GL_POSITION, light_position);
             ^
prog.cpp:69:24: error: 'GL_POSITION' was not declared in this scope
   glLightfv(GL_LIGHT0, GL_POSITION, light_position);
                        ^
prog.cpp:69:37: error: 'light_position' was not declared in this scope
   glLightfv(GL_LIGHT0, GL_POSITION, light_position);
                                     ^
prog.cpp:69:51: error: 'glLightfv' was not declared in this scope
   glLightfv(GL_LIGHT0, GL_POSITION, light_position);
                                                   ^
prog.cpp:71:12: error: 'GL_LIGHTING' was not declared in this scope
   glEnable(GL_LIGHTING);
            ^
prog.cpp:71:23: error: 'glEnable' was not declared in this scope
   glEnable(GL_LIGHTING);
                       ^
prog.cpp:75:13: error: 'GL_LIGHTING' was not declared in this scope
   glDisable(GL_LIGHTING);
             ^
prog.cpp:75:24: error: 'glDisable' was not declared in this scope
   glDisable(GL_LIGHTING);
                        ^
prog.cpp:79:2: error: 'GLfloat' was not declared in this scope
  GLfloat accel = 9.8 * M * pow(T, 2.0);
  ^
prog.cpp:80:6: error: 'T' was not declared in this scope
  if (T < 0.03){
      ^
prog.cpp:83:2: error: 'rainPos' was not declared in this scope
  rainPos -= accel;
  ^
prog.cpp:83:13: error: 'accel' was not declared in this scope
  rainPos -= accel;
             ^
prog.cpp:85:3: error: 'T' was not declared in this scope
   T = 0.0;
   ^
prog.cpp:90:6: error: 'sheepHeadDown' was not declared in this scope
  if (sheepHeadDown == false){
      ^
prog.cpp:91:7: error: 'sheepHead' was not declared in this scope
   if (sheepHead == 0.5 && sheepHeadRot > -50.0){
       ^
prog.cpp:91:27: error: 'sheepHeadRot' was not declared in this scope
   if (sheepHead == 0.5 && sheepHeadRot > -50.0){
                           ^
prog.cpp:102:7: error: 'sheepHead' was not declared in this scope
   if (sheepHead < 0.5){
       ^
prog.cpp:105:32: error: 'sheepHeadRot' was not declared in this scope
   else if (sheepHead == 0.5 && sheepHeadRot < 0.0){
                                ^
prog.cpp:112:6: error: 'pigHeadDown' was not declared in this scope
  if (pigHeadDown == false){
      ^
prog.cpp:113:7: error: 'pigHead' was not declared in this scope
   if (pigHead > -0.3){
       ^
prog.cpp:121:7: error: 'pigHead' was not declared in this scope
   if (pigHead < 0.5){
       ^
prog.cpp:128:6: error: 'sunPos' was not declared in this scope
  if (sunPos > 0.0){
      ^
prog.cpp:131:6: error: 'sunPos' was not declared in this scope
  if (sunPos <= 0.0 && sunPos > -2.2){
      ^
prog.cpp:133:7: error: 'skyColor' was not declared in this scope
   if (skyColor > 0.0){
       ^
prog.cpp:136:28: error: 'skyColor' was not declared in this scope
   glClearColor(0.0f, 0.0f, skyColor, 0.0f);
                            ^
prog.cpp:136:42: error: 'glClearColor' was not declared in this scope
   glClearColor(0.0f, 0.0f, skyColor, 0.0f);
                                          ^
prog.cpp:138:6: error: 'sunPos' was not declared in this scope
  if (sunPos <= -2.2 && sunColor == 0.0){
      ^
prog.cpp:138:24: error: 'sunColor' was not declared in this scope
  if (sunPos <= -2.2 && sunColor == 0.0){
                        ^
prog.cpp:146:6: error: 'sunPos' was not declared in this scope
  if (sunPos > 4.0 && sunColor == 0.0 && skyColor < 1.0){
      ^
prog.cpp:146:22: error: 'sunColor' was not declared in this scope
  if (sunPos > 4.0 && sunColor == 0.0 && skyColor < 1.0){
                      ^
prog.cpp:146:41: error: 'skyColor' was not declared in this scope
  if (sunPos > 4.0 && sunColor == 0.0 && skyColor < 1.0){
                                         ^
prog.cpp:148:42: error: 'glClearColor' was not declared in this scope
   glClearColor(0.0f, 0.0f, skyColor, 0.0f);
                                          ^
prog.cpp:151:20: error: 'glutPostRedisplay' was not declared in this scope
  glutPostRedisplay();
                    ^
prog.cpp: At global scope:
prog.cpp:154:12: error: variable or field 'sheep' declared void
 void sheep(GLdouble x, GLdouble y, GLdouble z){
            ^
prog.cpp:154:12: error: 'GLdouble' was not declared in this scope
prog.cpp:154:24: error: 'GLdouble' was not declared in this scope
 void sheep(GLdouble x, GLdouble y, GLdouble z){
                        ^
prog.cpp:154:36: error: 'GLdouble' was not declared in this scope
 void sheep(GLdouble x, GLdouble y, GLdouble z){
                                    ^
prog.cpp:187:10: error: variable or field 'pig' declared void
 void pig(GLdouble x, GLdouble y, GLdouble z){
          ^
prog.cpp:187:10: error: 'GLdouble' was not declared in this scope
prog.cpp:187:22: error: 'GLdouble' was not declared in this scope
 void pig(GLdouble x, GLdouble y, GLdouble z){
                      ^
prog.cpp:187:34: error: 'GLdouble' was not declared in this scope
 void pig(GLdouble x, GLdouble y, GLdouble z){
                                  ^
prog.cpp: In function 'void triangle(double, double, double)':
prog.cpp:220:17: error: 'glLoadIdentity' was not declared in this scope
  glLoadIdentity();
                 ^
prog.cpp:221:22: error: 'glTranslatef' was not declared in this scope
  glTranslatef(x, y, z);
                      ^
prog.cpp:222:25: error: 'glColor3f' was not declared in this scope
  glColor3f(0.0, 1.0, 0.0);
                         ^
prog.cpp:223:27: error: 'glScalef' was not declared in this scope
  glScalef(0.1f, 0.1f, 0.1f);
                           ^
prog.cpp:224:10: error: 'GL_POLYGON' was not declared in this scope
  glBegin(GL_POLYGON);
          ^
prog.cpp:224:20: error: 'glBegin' was not declared in this scope
  glBegin(GL_POLYGON);
                    ^
prog.cpp:225:22: error: 'glVertex2i' was not declared in this scope
   glVertex2i(0.0, 0.0);
                      ^
prog.cpp:228:8: error: 'glEnd' was not declared in this scope
  glEnd();
        ^
prog.cpp: In function 'void grass()':
prog.cpp:233:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp:237:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp:241:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp:245:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp:249:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp:253:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp:257:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp:261:18: error: 'glLoadIdentity' was not declared in this scope
   glLoadIdentity();
                  ^
prog.cpp: In function 'void clouds()':
prog.cpp:268:32: error: 'glTranslatef' was not declared in this scope
  glTranslatef(-2.0f, 1.0, -8.0f);
                                ^
prog.cpp:269:25: error: 'glColor3f' was not declared in this scope
  glColor3f(0.5, 0.5, 0.5);
                         ^
prog.cpp:270:30: error: 'glutSolidSphere' was not declared in this scope
  glutSolidSphere(0.25, 15, 15);
                              ^
prog.cpp: In function 'void rainDrop()':
prog.cpp:286:25: error: 'glColor3f' was not declared in this scope
  glColor3f(0.0, 1.0, 1.0);
                         ^
prog.cpp:287:2: error: 'GLubyte' was not declared in this scope
  GLubyte bitShape2[72] = {
  ^
prog.cpp:313:16: error: 'GL_UNPACK_ALIGNMENT' was not declared in this scope
  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
                ^
prog.cpp:313:38: error: 'glPixelStorei' was not declared in this scope
  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
                                      ^
prog.cpp:315:22: error: 'rainPos' was not declared in this scope
  glTranslatef(-0.1f, rainPos, -9.0f);
                      ^
prog.cpp:315:36: error: 'glTranslatef' was not declared in this scope
  glTranslatef(-0.1f, rainPos, -9.0f);
                                    ^
prog.cpp:316:25: error: 'glRasterPos2i' was not declared in this scope
  glRasterPos2i(-4.0, 0.0);
                         ^
prog.cpp:318:44: error: 'bitShape2' was not declared in this scope
  glBitmap(24.0, 24.0, 0.0, 0.0, 36.0, 0.0, bitShape2);
                                            ^
prog.cpp:318:53: error: 'glBitmap' was not declared in this scope
  glBitmap(24.0, 24.0, 0.0, 0.0, 36.0, 0.0, bitShape2);
                                                     ^
prog.cpp:323:10: error: 'glFlush' was not declared in this scope
  glFlush();
          ^
prog.cpp: In function 'void Menu()':
prog.cpp:328:28: error: 'glColor3f' was not declared in this scope
  glColor3f(1.0f, 1.0f, 0.0f);
                            ^
prog.cpp:329:79: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  renderBitmapString(-0.8, 2.7, (void *)font, "Press \"a\" to start animation.");
                                                                               ^
prog.cpp:330:79: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  renderBitmapString(-0.8, 2.4, (void *)font, "Press \"s\" to pause animation.");
                                                                               ^
prog.cpp: In function 'void displayMain()':
prog.cpp:335:10: error: 'GL_COLOR_BUFFER_BIT' was not declared in this scope
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          ^
prog.cpp:335:32: error: 'GL_DEPTH_BUFFER_BIT' was not declared in this scope
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                                ^
prog.cpp:335:51: error: 'glClear' was not declared in this scope
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                                                   ^
prog.cpp:338:15: error: 'GL_MODELVIEW' was not declared in this scope
  glMatrixMode(GL_MODELVIEW);
               ^
prog.cpp:338:27: error: 'glMatrixMode' was not declared in this scope
  glMatrixMode(GL_MODELVIEW);
                           ^
prog.cpp:340:17: error: 'glLoadIdentity' was not declared in this scope
  glLoadIdentity();
                 ^
prog.cpp:341:26: error: 'sheep' was not declared in this scope
  sheep(-1.15, -0.7, -7.0f);
                          ^
prog.cpp:342:24: error: 'pig' was not declared in this scope
  pig(3.0f, -0.7f, -7.0f);
                        ^
prog.cpp:347:29: error: 'glTranslatef' was not declared in this scope
  glTranslatef(0.0, 0.0, -8.0);
                             ^
prog.cpp:348:25: error: 'glColor3f' was not declared in this scope
  glColor3f(0.5, 0.5, 0.0);
                         ^
prog.cpp:349:35: error: 'glRecti' was not declared in this scope
  glRecti(-5.0, -5.0, 5.0, -1.99999);
                                   ^
prog.cpp:353:20: error: 'sunPos' was not declared in this scope
  glTranslatef(2.0, sunPos, -10.0);
                    ^
prog.cpp:354:22: error: 'sunColor' was not declared in this scope
  glColor3f(1.0, 1.0, sunColor);
                      ^
prog.cpp:355:27: error: 'glutSolidSphere' was not declared in this scope
  glutSolidSphere(1.0,15,15);
                           ^
prog.cpp:371:18: error: 'glutSwapBuffers' was not declared in this scope
  glutSwapBuffers();
                  ^
prog.cpp: In function 'void keyboard(unsigned char, int, int)':
prog.cpp:379:26: error: 'glutIdleFunc' was not declared in this scope
   glutIdleFunc(animateAll);
                          ^
prog.cpp:383:16: error: 'NULL' was not declared in this scope
   glutIdleFunc(NULL);
                ^
prog.cpp: At global scope:
prog.cpp:391:20: error: variable or field 'winReshapeFcn' declared void
 void winReshapeFcn(GLsizei width, GLsizei height) {
                    ^
prog.cpp:391:20: error: 'GLsizei' was not declared in this scope
prog.cpp:391:35: error: 'GLsizei' was not declared in this scope
 void winReshapeFcn(GLsizei width, GLsizei height) {
                                   ^
prog.cpp:410:32: error: '::main' must return 'int'
 void main(int argc, char** argv) {
                                ^
prog.cpp: In function 'int main(int, char**)':
prog.cpp:411:22: error: 'glutInit' was not declared in this scope
  glutInit(&argc, argv);
                      ^
prog.cpp:412:22: error: 'GLUT_DOUBLE' was not declared in this scope
  glutInitDisplayMode(GLUT_DOUBLE);
                      ^
prog.cpp:412:33: error: 'glutInitDisplayMode' was not declared in this scope
  glutInitDisplayMode(GLUT_DOUBLE);
                                 ^
prog.cpp:414:21: error: 'winWidth' was not declared in this scope
  glutInitWindowSize(winWidth, winHeight);
                     ^
prog.cpp:414:31: error: 'winHeight' was not declared in this scope
  glutInitWindowSize(winWidth, winHeight);
                               ^
prog.cpp:414:40: error: 'glutInitWindowSize' was not declared in this scope
  glutInitWindowSize(winWidth, winHeight);
                                        ^
prog.cpp:416:31: error: 'glutInitWindowPosition' was not declared in this scope
  glutInitWindowPosition(50, 50);
                               ^
prog.cpp:418:24: error: 'glutCreateWindow' was not declared in this scope
  glutCreateWindow(title);
                        ^
prog.cpp:420:29: error: 'glutDisplayFunc' was not declared in this scope
  glutDisplayFunc(displayMain);
                             ^
prog.cpp:422:18: error: 'winReshapeFcn' was not declared in this scope
  glutReshapeFunc(winReshapeFcn);
                  ^
prog.cpp:422:31: error: 'glutReshapeFunc' was not declared in this scope
  glutReshapeFunc(winReshapeFcn);
                               ^
prog.cpp:427:27: error: 'glutKeyboardFunc' was not declared in this scope
  glutKeyboardFunc(keyboard);
                           ^
prog.cpp:430:15: error: 'glutMainLoop' was not declared in this scope
  glutMainLoop();
               ^
stdout
Standard output is empty