Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

74 lignes
1.5 KiB

  1. #include <iostream>
  2. #include <GL/gl.h>
  3. #include <GL/glut.h>
  4. #include <exception>
  5. #include "example.h"
  6. #include "helper.h"
  7. static int windowId;
  8. static int screenw, screenh;
  9. static void Resize(int width, int height)
  10. {
  11. screenw = width;
  12. screenh = height;
  13. glViewport(0, 0, screenw, screenh);
  14. glMatrixMode(GL_PROJECTION);
  15. glLoadIdentity();
  16. glOrtho(0, screenw, screenh, 0, -10, 10);
  17. glMatrixMode(GL_MODELVIEW);
  18. glLoadIdentity();
  19. }
  20. static void Render(void)
  21. {
  22. try
  23. {
  24. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  25. if (!exampleRender(screenw, screenh))
  26. {
  27. glutDestroyWindow(windowId);
  28. return;
  29. }
  30. glutSwapBuffers();
  31. }
  32. catch(const std::exception& ex)
  33. {
  34. std::cout << "Exception: " << ex.what() << std::endl;
  35. glutDestroyWindow(windowId);
  36. }
  37. }
  38. int main(int argc, char** argv)
  39. {
  40. try
  41. {
  42. glutInit(&argc, argv);
  43. glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
  44. glutInitWindowSize(640, 480);
  45. windowId = glutCreateWindow("libTextSuite example");
  46. glClearColor(1.0, 1.0, 1.0, 1.0);
  47. if (!exampleInit())
  48. return 1;
  49. glutReshapeFunc(Resize);
  50. glutDisplayFunc(Render);
  51. glutMainLoop();
  52. exampleFinish();
  53. }
  54. catch(const std::exception& ex)
  55. {
  56. std::cout << "Exception: " << ex.what() << std::endl;
  57. }
  58. }