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.
 
 
 

57 lignes
1.2 KiB

  1. //
  2. // Deus Hax (working title)
  3. // Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
  4. //
  5. #if defined HAVE_CONFIG_H
  6. # include "config.h"
  7. #endif
  8. #ifdef WIN32
  9. # define WIN32_LEAN_AND_MEAN
  10. # include <windows.h>
  11. #endif
  12. #if defined __APPLE__ && defined __MACH__
  13. # include <OpenGL/gl.h>
  14. #else
  15. # define GL_GLEXT_PROTOTYPES
  16. # include <GL/gl.h>
  17. #endif
  18. #include "video.h"
  19. /*
  20. * Public Video class
  21. */
  22. void Video::Setup(int width, int height)
  23. {
  24. /* Initialise OpenGL */
  25. glViewport(0, 0, width, height);
  26. glEnable(GL_TEXTURE_2D);
  27. glShadeModel(GL_SMOOTH);
  28. glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  29. glClearDepth(1.0);
  30. glEnable(GL_DEPTH_TEST);
  31. glDepthFunc(GL_LEQUAL);
  32. glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
  33. glEnable(GL_BLEND);
  34. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  35. /* Projection matrix: once and for all */
  36. glMatrixMode(GL_PROJECTION);
  37. glLoadIdentity();
  38. glOrtho(0, width, height, 0, -(width + height), width + height);
  39. }
  40. void Video::Clear()
  41. {
  42. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  43. /* Model view matrix: for each frame, just in case */
  44. glMatrixMode(GL_MODELVIEW);
  45. glLoadIdentity();
  46. }