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.

88 lines
1.9 KiB

  1. #include <windows.h>
  2. #include <gl\gl.h>
  3. #include <gl\glaux.h>
  4. #include <stdio.h>
  5. #include "skeltest.h"
  6. #include "hugetest.h"
  7. #include "teapot.h"
  8. TeapotTest::TeapotTest()
  9. {
  10. SetThisType("Teapot");
  11. SetThisVersion("1.0");
  12. td.swapbuffers = TRUE;
  13. td.iDuration = 30000;
  14. td.iX = 0;
  15. td.iY = 0;
  16. td.iW = 640;
  17. td.iH = 480;
  18. sprintf(td.acName, "3D Teapot (aux)");
  19. sprintf(td.acTestStatName, "Frames");
  20. bd.uiClear = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
  21. bd.fClearColor[0] = 0.0f;
  22. bd.fClearColor[1] = 0.0f;
  23. bd.fClearColor[2] = 0.0f;
  24. bd.cColorBits = 24;
  25. bd.cDepthBits = 16;
  26. bd.bDepthTestEnable = TRUE;
  27. bd.iDepthFunction = LEQUAL;
  28. bd.bNormalize = TRUE;
  29. bd.bAutoNormal = TRUE;
  30. bd.iShadeModel = SMOOTH;
  31. rd.bPolyCullFaceEnable = TRUE;
  32. rd.iPolyDir = GL_CW;
  33. afDrawColor[0] = 1.0;
  34. afDrawColor[1] = 1.0;
  35. afDrawColor[2] = 1.0;
  36. range.fxMin = -3.5;
  37. range.fyMin = -3.5;
  38. range.fzMin = -3.5;
  39. range.fxMax = 3.5;
  40. range.fyMax = 3.5;
  41. range.fzMax = 3.5;
  42. fAngle = 0.0f;
  43. }
  44. GLfloat specref[] = { 1.0f, 1.0f, 1.0f, 1.0f };
  45. void TeapotTest::INITFUNCTION()
  46. {
  47. parent::initfunct(w,h);
  48. // Set Material properties to follow glColor values
  49. glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
  50. // All materials hereafter have full specular reflectivity
  51. // with a high shine
  52. glMaterialfv(GL_FRONT, GL_SPECULAR, specref);
  53. glMateriali(GL_FRONT, GL_SHININESS, 128);
  54. }
  55. void TeapotTest::IDLEFUNCTION()
  56. {
  57. fAngle += 5.0f;
  58. }
  59. void TeapotTest::RENDFUNCTION()
  60. {
  61. glClearColor(bd.fClearColor[0],bd.fClearColor[1],
  62. bd.fClearColor[2],bd.fClearColor[3]);
  63. glClear(bd.uiClear);
  64. glColor3f(afDrawColor[0], afDrawColor[1], afDrawColor[2]);
  65. glPushMatrix(); {
  66. glRotatef(30.0, 1.0, 0.0, 0.0);
  67. glRotatef(fAngle, 0.0, 1.0, 0.0);
  68. auxSolidTeapot(2.0);
  69. } glPopMatrix();
  70. glFlush();
  71. }