Advertisement
naeem043

Multitiangle

Jan 2nd, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.80 KB | None | 0 0
  1. //#include <GL/glut.h>
  2. //
  3. //void shapes (void) {
  4. //  double x=.12,y=.12,w1,w2,w3,h1,h2;
  5. //  int i;
  6. //  for(i=0;i<14;i++)
  7. //  {
  8. //      glBegin(GL_TRIANGLES);
  9. //      if(i==0)
  10. //      {
  11. //          glColor3f(1.0, 0.0, 0.0);
  12. //          w1=x*0;
  13. //          w2=x*16;
  14. //          w3=x*8;                         //1st T
  15. //          h1=y*0;
  16. //          h2=y*8;
  17. //      }
  18. //      if(i==1)
  19. //      {
  20. //          glColor3f(0.0, 1.0, 0.0);
  21. //          w1=x*4;
  22. //          w2=x*12;
  23. //          w3=x*8;                         //2nd T
  24. //          h1=y*4;
  25. //          h2=y*0;
  26. //      }
  27. //      if(i==2)
  28. //      {
  29. //          glColor3f(0.0, 0.0, 1.0);
  30. //          w1=x*6;
  31. //          w2=x*10;                        //3rd T
  32. //          w3=x*8;
  33. //          h1=y*6;
  34. //          h2=y*4;
  35. //      }
  36. //      if(i==3)
  37. //      {
  38. //          glColor3f(0.0, 1.0, 1.0);
  39. //          w1=x*2;
  40. //          w2=x*6;                     //4th T
  41. //          w3=x*4;
  42. //          h1=y*2;
  43. //          h2=y*0;
  44. //      }
  45. //      if(i==4)
  46. //      {
  47. //          glColor3f(1.0, 0.0, 1.0);
  48. //          w1=x*10;
  49. //          w2=x*14;                        //5th T
  50. //          w3=x*12;
  51. //          h1=y*2;
  52. //          h2=y*0;
  53. //      }
  54. //      if(i==5)
  55. //      {
  56. //          glColor3f(1.0, 1.0, 0.0);
  57. //          w1=x*1;
  58. //          w2=x*3;                     //6th T
  59. //          w3=x*2;
  60. //          h1=y*1;
  61. //          h2=y*0;
  62. //      }
  63. //      if(i==6)
  64. //      {
  65. //          glColor3f(1.0, 1.0, 0.0);
  66. //          w1=x*5;
  67. //          w2=x*7;                     //7th T
  68. //          w3=x*6;
  69. //          h1=y*1;
  70. //          h2=y*0;
  71. //      }
  72. //      if(i==7)
  73. //      {
  74. //          glColor3f(1.0, 1.0, 0.0);
  75. //          w1=x*9;
  76. //          w2=x*11;                        //8th T
  77. //          w3=x*10;
  78. //          h1=y*1;
  79. //          h2=y*0;
  80. //      }
  81. //      if(i==8)
  82. //      {
  83. //          glColor3f(1.0, 1.0, 0.0);
  84. //          w1=x*13;
  85. //          w2=x*15;                        //9th T
  86. //          w3=x*14;
  87. //          h1=y*1;
  88. //          h2=y*0;
  89. //      }
  90. //      if(i==9)
  91. //      {
  92. //          glColor3f(1.0, 1.0, 0.0);
  93. //          w1=x*3;
  94. //          w2=x*5;                     //10th T
  95. //          w3=x*4;
  96. //          h1=y*3;
  97. //          h2=y*2;
  98. //      }
  99. //      if(i==10)
  100. //      {
  101. //          glColor3f(1.0, 1.0, 0.0);
  102. //          w1=x*11;
  103. //          w2=x*13;                        //11th T
  104. //          w3=x*12;
  105. //          h1=y*3;
  106. //          h2=y*2;
  107. //      }
  108. //      if(i==11)
  109. //      {
  110. //          glColor3f(1.0, 1.0, 0.0);
  111. //          w1=x*5;
  112. //          w2=x*7;                     //12th T
  113. //          w3=x*6;
  114. //          h1=y*5;
  115. //          h2=y*4;
  116. //      }
  117. //      if(i==12)
  118. //      {
  119. //          glColor3f(1.0, 1.0, 0.0);
  120. //          w1=x*9;
  121. //          w2=x*11;                        //13th T
  122. //          w3=x*10;
  123. //          h1=y*5;
  124. //          h2=y*4;
  125. //      }
  126. //      if(i==13)
  127. //      {
  128. //          glColor3f(1.0, 1.0, 0.0);
  129. //          w1=x*7;
  130. //          w2=x*9;                     //14th T
  131. //          w3=x*8;
  132. //          h1=y*7;
  133. //          h2=y*6;
  134. //      }
  135. // 
  136. //  glVertex2f(w1,h1);         
  137. //  glVertex2f(w2,h1);
  138. //  glVertex2f(w3,h2);
  139. //  glEnd();
  140. //  }
  141. //}
  142. //
  143. //void display (void) {
  144. //
  145. //  // clearing the window with black color, 1st 3 parameter are for R,G,B. last one for opacity
  146. //  glClearColor (0.0,0.0,0.0,1.0);
  147. //    glClear (GL_COLOR_BUFFER_BIT);
  148. //    glLoadIdentity();  
  149. //       //viewing transformation
  150. //  //glulookat() positions the camera towards the object
  151. //  //camera position, camera target, upvector
  152. //    gluLookAt (0.0, 0.0, 8.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
  153. //  shapes();
  154. //  glFlush();
  155. //}
  156. //
  157. //void reshape (int w, int h) {
  158. //
  159. //  // 1st 2 parameters for lower left corner of the viewport rectangle. the default is 0,0
  160. //  // the next coordinates are width and hight of the viewport
  161. ////Set the viewport to be the entire window
  162. //  glViewport (0, 0, (GLsizei)w, (GLsizei)h);
  163. //
  164. //  // setting the camera
  165. //  glMatrixMode (GL_PROJECTION);
  166. //  glLoadIdentity ();  
  167. //
  168. //  //perspective transform
  169. //  //gluPerspective (30, (GLfloat)w / (GLfloat)h, 1.0, 100.0);
  170. //  gluPerspective (30, 1, 1.0, 100.0);
  171. //  glMatrixMode (GL_MODELVIEW); //switch back the the model editing mode.
  172. //
  173. //}
  174. //
  175. //int main (int argc, char **argv) {
  176. //    glutInit (&argc, argv);
  177. //  glutInitDisplayMode (GLUT_SINGLE); // single buffering.. (double buffering for animation)
  178. //  // full screen is 1000,1000
  179. //  // this 0,0 or 1000,1000 are world co ordinates
  180. //  glutInitWindowSize (1000, 1000);
  181. //  glutInitWindowPosition (100, 100);
  182. //    glutCreateWindow ("A basic OpenGL Window");
  183. //  // registering callback functions
  184. //    glutDisplayFunc (display);  
  185. //  glutReshapeFunc (reshape);
  186. // 
  187. //    glutMainLoop ();
  188. //    return 0;
  189. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement