Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

68 righe
1.7 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // Lol Engine is free software. It comes without any warranty, to
  7. // the extent permitted by applicable law. You can redistribute it
  8. // and/or modify it under the terms of the Do What the Fuck You Want
  9. // to Public License, Version 2, as published by the WTFPL Task Force.
  10. // See http://www.wtfpl.net/ for more details.
  11. //
  12. #pragma once
  13. //
  14. // The GL support
  15. // --------------
  16. //
  17. #define GL_GLEXT_PROTOTYPES
  18. /* Prefer GLES on browsers */
  19. #if defined __EMSCRIPTEN__
  20. # undef HAVE_GL_2X
  21. # undef LOL_USE_GLEW
  22. #endif
  23. /* Only define one GL platform */
  24. #if defined HAVE_GL_2X
  25. # undef HAVE_GLES_2X
  26. #endif
  27. /* Include GL development headers.
  28. * Do not include glew.h on OS X, because the version shipped with Fink
  29. * links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
  30. #if defined LOL_USE_GLEW && !defined __APPLE__
  31. # include <GL/glew.h>
  32. #elif defined HAVE_GL_2X
  33. # if defined __APPLE__ && defined __MACH__ && defined __arm__
  34. # include <OpenGL/gl.h>
  35. # elif defined __APPLE__ && defined __MACH__
  36. # define MACOS_OPENGL
  37. # define GL_GLEXT_PROTOTYPES
  38. # include <OpenGL/OpenGL.h>
  39. # include <OpenGL/gl.h>
  40. # include <OpenGL/glext.h>
  41. # else
  42. # define GL_GLEXT_PROTOTYPES
  43. # include <GL/gl.h>
  44. # include <GL/glext.h>
  45. # endif
  46. #elif defined HAVE_GLES_2X
  47. # if defined __APPLE__ && defined __MACH__
  48. # include <OpenGLES/ES2/gl.h>
  49. # include <OpenGLES/ES2/glext.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. }