Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 17th, 2018 77 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include<d:\grafika lab_2\grafika lab_2\glut.h>
  2. #include<math.h>
  3. #define M_PI 3.14159265358979323846
  4.  
  5. void myInit(void);
  6. void myDisplay(void);
  7.  
  8. int main(int argc, char **argv) {
  9. glutInit(&argc, argv);
  10. glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  11. glutInitWindowSize(640, 480);
  12. glutInitWindowPosition(100, 150);
  13. glutCreateWindow("Lab 2");
  14.  
  15. myInit();
  16. glutDisplayFunc(myDisplay);
  17. glutMainLoop();
  18. }
  19.  
  20. void myInit(void) {
  21. glClearColor(1.0, 1.0, 1.0, 1.0);
  22. glColor3f(0.0f, 0.0f, 0.0f);
  23. glPointSize(4.0);
  24. glMatrixMode(GL_PROJECTION);
  25. glLoadIdentity();
  26. gluOrtho2D(0, 640, 0, 480);
  27. }
  28.  
  29. void myDisplay(void) {
  30. glClear(GL_COLOR_BUFFER_BIT);
  31.  
  32. glBegin(GL_TRIANGLES);
  33.     glVertex2d(160, 150);
  34.     glVertex2d(110, 200);
  35.         glVertex2d(50, 55);
  36. glEnd();
  37.  
  38. GLubyte christmas[] = {
  39. 0x00, 0x00, 0xC0, 0x00,
  40. 0x00, 0x00, 0x00, 0x00,
  41. 0x00, 0x00, 0x00, 0x00,
  42. 0x00, 0x00, 0x00, 0x00,
  43. 0x00, 0x00, 0x00, 0x00,
  44. 0x00, 0x00, 0x00, 0x00,
  45. 0x00, 0x00, 0x00, 0x00,
  46. 0x00, 0x00, 0x00, 0x00,
  47. 0x00, 0x00, 0x00, 0x00,
  48. 0x00, 0x00, 0x00, 0x00,
  49. 0x00, 0x00, 0x00, 0x00,
  50. 0x3F, 0xC0, 0xC0, 0x00,
  51. 0x26, 0x47, 0xF8, 0x00,
  52. 0x26, 0x43, 0xF0, 0x00,
  53. 0x3F, 0xC1, 0xE0, 0x00,
  54. 0x3F, 0xC7, 0xF8, 0x00,
  55. 0x26, 0x43, 0xF0, 0x00,
  56. 0x26, 0x41, 0xE0, 0x00,
  57. 0x3F, 0xC7, 0xF8, 0x00,
  58. 0x0F, 0x03, 0xF0, 0x00,
  59. 0x16, 0x81, 0xE6, 0x30,
  60. 0x09, 0x01, 0xE5, 0x50,
  61. 0x00, 0x00, 0xC2, 0xA0,
  62. 0x00, 0x00, 0x06, 0x30,
  63. 0x00, 0x00, 0x08, 0x08,
  64. 0x00, 0x00, 0x10, 0x04,
  65. 0x00, 0x00, 0x3C, 0x1E,
  66. 0x00, 0x00, 0x02, 0x10,
  67. 0x00, 0x00, 0x01, 0x40,
  68. 0x00, 0x00, 0x01, 0x40,
  69. 0x00, 0x00, 0x00, 0x80,
  70. 0x00, 0x00, 0x00, 0x00
  71. };
  72.  
  73. glEnable(GL_POLYGON_STIPPLE);
  74.     glPolygonStipple(christmas);
  75.     glBegin(GL_QUADS);
  76.         glVertex2d(300, 20);
  77.         glVertex2d(250, 270);
  78.         glVertex2d(500, 320);
  79.         glVertex2d(500, 20);
  80.     glEnd();
  81. glDisable(GL_POLYGON_STIPPLE);
  82.  
  83. glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  84. glBegin(GL_POLYGON);
  85.     glVertex2d(30, 360);
  86.     glVertex2d(200, 450);
  87.     glVertex2d(200, 320);
  88.     glVertex2d(170, 260);
  89.     glVertex2d(20, 350);
  90. glEnd();
  91.  
  92. glBegin(GL_TRIANGLES);
  93.     glVertex2d(250, 470);
  94.     glEdgeFlag(GL_FALSE);
  95.     glVertex2d(250, 380);
  96.     glVertex2d(320, 425);
  97.     glEdgeFlag(GL_TRUE);
  98. glEnd();
  99.  
  100. glBegin(GL_TRIANGLES);
  101.     glVertex2d(250, 470);
  102.     glVertex2d(500, 470);
  103.     glEdgeFlag(GL_FALSE);
  104.     glVertex2d(320, 425);
  105.     glEdgeFlag(GL_TRUE);
  106. glEnd();
  107.  
  108. glBegin(GL_TRIANGLES);
  109.     glVertex2d(320, 425);
  110.     glVertex2d(500, 380);
  111.     glEdgeFlag(GL_FALSE);
  112.     glVertex2d(250, 380);
  113.     glEdgeFlag(GL_TRUE);
  114. glEnd();
  115.  
  116. glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  117. glFlush();
  118.  
  119. }
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
 
Top