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.
 
 
 

64 regels
1.6 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. #pragma once
  11. //
  12. // The GL support
  13. // --------------
  14. //
  15. #define GL_GLEXT_PROTOTYPES
  16. /* Prefer GLES on browsers */
  17. #if defined EMSCRIPTEN
  18. # undef HAVE_GL_2X
  19. #endif
  20. /* Only define one GL platform */
  21. #if defined HAVE_GL_2X
  22. # undef HAVE_GLES_2X
  23. #endif
  24. /* Include GL development headers.
  25. * Do not include glew.h on OS X, because the version shipped with Fink
  26. * links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
  27. #if defined USE_GLEW && !defined __APPLE__
  28. # include <glew.h>
  29. #elif defined HAVE_GL_2X
  30. # if defined __APPLE__ && defined __MACH__ && defined __arm__
  31. # include <OpenGL/gl.h>
  32. # elif defined __APPLE__ && defined __MACH__
  33. # define MACOS_OPENGL
  34. # define GL_GLEXT_PROTOTYPES
  35. # include <OpenGL/OpenGL.h>
  36. # include <OpenGL/gl.h>
  37. # include <OpenGL/glext.h>
  38. # else
  39. # define GL_GLEXT_PROTOTYPES
  40. # include <GL/gl.h>
  41. # endif
  42. #elif defined HAVE_GLES_2X
  43. # if defined __APPLE__ && defined __MACH__
  44. # include <OpenGLES/ES2/gl.h>
  45. # include <OpenGLES/ES2/glext.h>
  46. # else
  47. # include <GLES2/gl2.h>
  48. # include <GLES2/gl2ext.h>
  49. # endif
  50. #endif
  51. #define LOL_CHECK_GLERROR() \
  52. { \
  53. GLenum error = glGetError(); \
  54. ASSERT(error == GL_NO_ERROR, "OpenGL error: 0x%04x\n", error); \
  55. }