Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.5 KiB

  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <gl\gl.h>
  4. #include "skeltest.h"
  5. #include "large1.h"
  6. LargeTriangle::LargeTriangle()
  7. {
  8. td.swapbuffers = FALSE;
  9. td.iDuration = 10000;
  10. td.iX = 0;
  11. td.iY = 0;
  12. td.iW = 640;
  13. td.iH = 480;
  14. sprintf(td.acName, "Large Triangles (demo only)");
  15. bd.cColorBits = 8;
  16. bd.cDepthBits = 8;
  17. fClr1 = 1.0f,
  18. fClr2 = 1.0f,
  19. fClr3 = 0.0f,
  20. fClr4 = 0.0f,
  21. fClr5 = 1.0f,
  22. fClr6 = 0.0f;
  23. }
  24. void LargeTriangle::INITFUNCTION()
  25. {
  26. // Prevent a divide by zero, when window is too short
  27. // (you cant make a window of zero width).
  28. if(h == 0) h = 1;
  29. // Set the viewport to be the entire window
  30. glViewport(0, 0, w, h);
  31. // Reset the coordinate system before modifying
  32. glLoadIdentity();
  33. fWindowWidth = (GLfloat) w;
  34. fWindowHeight = (GLfloat) h;
  35. // Set the clipping volume
  36. glOrtho(0.0f, fWindowWidth, 0.0f, fWindowHeight, 1.0f, -1.0f);
  37. }
  38. void LargeTriangle::IDLEFUNCTION()
  39. {
  40. GLfloat fClr;
  41. fClr = fClr1;
  42. fClr1 = fClr2;
  43. fClr2 = fClr3;
  44. fClr3 = fClr4;
  45. fClr4 = fClr5;
  46. fClr5 = fClr6;
  47. fClr6 = fClr;
  48. }
  49. void LargeTriangle::RENDFUNCTION()
  50. {
  51. // Set drawing colors, and draw (2) Large Triagles
  52. glBegin(GL_TRIANGLES);
  53. glColor3f(fClr1, fClr2, fClr3);
  54. glVertex2f(0.0f,0.0f);
  55. glVertex2f(0.0f,fWindowHeight);
  56. glVertex2f(fWindowWidth,fWindowHeight);
  57. glColor3f(fClr4, fClr5, fClr6);
  58. glVertex2f(0.0f,0.0f);
  59. glVertex2f(fWindowWidth,fWindowHeight);
  60. glVertex2f(fWindowWidth,0.0f);
  61. glEnd();
  62. glFlush();
  63. }