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.
 
 
 

67 lines
1.7 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright © 2010—2016 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. #endif
  22. /* Only define one GL platform */
  23. #if defined HAVE_GL_2X
  24. # undef HAVE_GLES_2X
  25. #endif
  26. /* Include GL development headers.
  27. * Do not include glew.h on OS X, because the version shipped with Fink
  28. * links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
  29. #if defined LOL_USE_GLEW && !defined __APPLE__
  30. # include <GL/glew.h>
  31. #elif defined HAVE_GL_2X
  32. # if defined __APPLE__ && defined __MACH__ && defined __arm__
  33. # include <OpenGL/gl.h>
  34. # elif defined __APPLE__ && defined __MACH__
  35. # define MACOS_OPENGL
  36. # define GL_GLEXT_PROTOTYPES
  37. # include <OpenGL/OpenGL.h>
  38. # include <OpenGL/gl.h>
  39. # include <OpenGL/glext.h>
  40. # else
  41. # define GL_GLEXT_PROTOTYPES
  42. # include <GL/gl.h>
  43. # include <GL/glext.h>
  44. # endif
  45. #elif defined HAVE_GLES_2X
  46. # if defined __APPLE__ && defined __MACH__
  47. # include <OpenGLES/ES2/gl.h>
  48. # include <OpenGLES/ES2/glext.h>
  49. # else
  50. # include <GLES2/gl2.h>
  51. # include <GLES2/gl2ext.h>
  52. # endif
  53. #endif
  54. #define LOL_CHECK_GLERROR() \
  55. { \
  56. GLenum error = glGetError(); \
  57. ASSERT(error == GL_NO_ERROR, "OpenGL error: 0x%04x\n", error); \
  58. }