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.

70 lignes
1.7 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. //
  11. // The GL support
  12. // --------------
  13. //
  14. #if !defined __LOL_LOLGL_H__
  15. #define __LOL_LOLGL_H__
  16. #define GL_GLEXT_PROTOTYPES
  17. /* Prefer GLES on browsers */
  18. #if defined EMSCRIPTEN
  19. # undef HAVE_GL_2X
  20. #endif
  21. /* Only define one GL platform */
  22. #if defined HAVE_GL_2X
  23. # undef HAVE_GLES_2X
  24. #endif
  25. /* Include GL development headers.
  26. * Do not include glew.h on OS X, because the version shipped with Fink
  27. * links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
  28. #if defined USE_GLEW && !defined __APPLE__
  29. # include <glew.h>
  30. #elif defined HAVE_GL_2X
  31. # if defined __APPLE__ && defined __MACH__ && defined __arm__
  32. # include <OpenGL/gl.h>
  33. # elif defined __APPLE__ && defined __MACH__
  34. # define MACOS_OPENGL
  35. # define GL_GLEXT_PROTOTYPES
  36. # include <OpenGL/OpenGL.h>
  37. # include <OpenGL/gl.h>
  38. # include <OpenGL/glext.h>
  39. # else
  40. # define GL_GLEXT_PROTOTYPES
  41. # include <GL/gl.h>
  42. # endif
  43. #elif defined HAVE_GLES_2X
  44. # if defined __APPLE__ && defined __MACH__
  45. # include <OpenGLES/ES2/gl.h>
  46. # include <OpenGLES/ES2/glext.h>
  47. # elif defined __CELLOS_LV2__
  48. # include <PSGL/psgl.h>
  49. # include <PSGL/psglu.h>
  50. # else
  51. # include <GLES2/gl2.h>
  52. # include <GLES2/gl2ext.h>
  53. # endif
  54. #endif
  55. #define LOL_CHECK_GLERROR() \
  56. { \
  57. GLenum error = glGetError(); \
  58. ASSERT(error == GL_NO_ERROR, "OpenGL error: 0x%04x\n", error); \
  59. }
  60. #endif // __LOL_LOLGL_H__