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.

65 lines
1.3 KiB

  1. /* A simple triangle program */
  2. #include <windows.h>
  3. #include <stdio.h>
  4. #include <GL/gl.h>
  5. #include "glaux.h"
  6. void display(void)
  7. {
  8. printf("display called\n");
  9. glClear(GL_COLOR_BUFFER_BIT);
  10. glBegin(GL_TRIANGLES);
  11. glColor3f(1.0F, 0.0F, 0.0F);
  12. glVertex2f(10.0F, 10.0F);
  13. glColor3f(0.0F, 1.0F, 0.0F);
  14. glVertex2f(250.0F, 50.0F);
  15. glColor3f(0.0F, 0.0F, 1.0F);
  16. glVertex2f(105.0F, 280.0F);
  17. glEnd();
  18. glFlush();
  19. }
  20. void myinit(void)
  21. {
  22. glClearColor(0.0F, 0.0F, 0.4F, 1.0F);
  23. glShadeModel(GL_SMOOTH);
  24. glDisable(GL_DITHER);
  25. }
  26. void apressed(key, mask)
  27. {
  28. printf("key is %d, mask is 0x%x\n", key, mask);
  29. }
  30. void LeftPressed(AUX_EVENTREC *event)
  31. {
  32. printf("Left pressed (%d, %d)\n", event->data[AUX_MOUSEX],
  33. event->data[AUX_MOUSEY]);
  34. }
  35. void LeftReleased(AUX_EVENTREC *event)
  36. {
  37. printf("Left released (%d, %d)\n", event->data[AUX_MOUSEX],
  38. event->data[AUX_MOUSEY]);
  39. }
  40. int main(int argc, char *argv[])
  41. {
  42. auxInitDisplayMode(AUX_SINGLE | AUX_RGBA | AUX_FIXED_332_PAL);
  43. auxInitPosition(100, 150, 300, 300);
  44. auxInitWindow("Tri w/ fixed 332 pal");
  45. myinit();
  46. auxKeyFunc(AUX_a, apressed);
  47. auxMouseFunc(AUX_LEFTBUTTON, AUX_MOUSEDOWN, LeftPressed);
  48. auxMouseFunc(AUX_LEFTBUTTON, AUX_MOUSEUP, LeftReleased);
  49. auxMainLoop(display);
  50. return 0;
  51. }