You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
1.9 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_NN_GLL_GLL_GL_H
  33. # include <nn/gll/gll_Gl.h>
  34. #elif defined HAVE_GL_2X
  35. # if defined __APPLE__ && defined __MACH__ && defined __arm__
  36. # include <OpenGL/gl.h>
  37. # elif defined __APPLE__ && defined __MACH__
  38. # define MACOS_OPENGL
  39. # define GL_GLEXT_PROTOTYPES
  40. # include <OpenGL/OpenGL.h>
  41. # include <OpenGL/gl3.h>
  42. # include <OpenGL/gl3ext.h>
  43. # else
  44. # define GL_GLEXT_PROTOTYPES
  45. # include <GL/gl.h>
  46. # include <GL/glext.h>
  47. # endif
  48. #elif defined HAVE_GLES_2X
  49. # if defined __APPLE__ && defined __MACH__
  50. # include <OpenGLES/ES2/gl.h>
  51. # include <OpenGLES/ES2/glext.h>
  52. # else
  53. # include <GLES2/gl2.h>
  54. # include <GLES2/gl2ext.h>
  55. # endif
  56. #endif
  57. #define LOL_STRINGIFY_INNER(n) #n
  58. #define LOL_STRINGIFY(n) LOL_STRINGIFY_INNER(n)
  59. #define LOL_CHECK_GLERROR() \
  60. { \
  61. GLenum error = glGetError(); \
  62. if (error != GL_NO_ERROR) \
  63. lol::gpu::error(__FILE__ ":" LOL_STRINGIFY(__LINE__), (int)error); \
  64. }