Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

57 rader
1.1 KiB

  1. #include <GL/gl.h>
  2. #include <GL/glut.h>
  3. #include "example.h"
  4. #include "helper.h"
  5. static int windowId;
  6. static int screenw, screenh;
  7. static void Resize(int width, int height)
  8. {
  9. screenw = width;
  10. screenh = height;
  11. glViewport(0, 0, screenw, screenh);
  12. glMatrixMode(GL_PROJECTION);
  13. glLoadIdentity();
  14. glOrtho(0, screenw, screenh, 0, -10, 10);
  15. glMatrixMode(GL_MODELVIEW);
  16. glLoadIdentity();
  17. }
  18. static void Render(void)
  19. {
  20. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  21. if (!exampleRender(screenw, screenh))
  22. {
  23. glutDestroyWindow(windowId);
  24. return;
  25. }
  26. glutSwapBuffers();
  27. }
  28. int main(int argc, char** argv)
  29. {
  30. glutInit(&argc, argv);
  31. glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
  32. glutInitWindowSize(640, 480);
  33. windowId = glutCreateWindow("libTextSuite example");
  34. glClearColor(1.0, 1.0, 1.0, 1.0);
  35. if (!exampleInit())
  36. return 1;
  37. glutReshapeFunc(Resize);
  38. glutDisplayFunc(Render);
  39. glutMainLoop();
  40. exampleFinish();
  41. }