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.

127 lines
3.0KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 3 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the LICENSE file.
  16. */
  17. // this file matches the top of `OpenGL.hpp` provided by DPF
  18. #pragma once
  19. #ifdef NDEBUG
  20. # undef DEBUG
  21. #endif
  22. /* Check OS */
  23. #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  24. # define DISTRHO_OS_WINDOWS 1
  25. #else
  26. # if defined(__APPLE__)
  27. # define DISTRHO_OS_MAC 1
  28. # endif
  29. #endif
  30. // -----------------------------------------------------------------------
  31. // Fix OpenGL includes for Windows, based on glfw code (part 1)
  32. #undef DGL_CALLBACK_DEFINED
  33. #undef DGL_WINGDIAPI_DEFINED
  34. #ifdef DISTRHO_OS_WINDOWS
  35. #ifndef APIENTRY
  36. # define APIENTRY __stdcall
  37. #endif // APIENTRY
  38. /* We need WINGDIAPI defined */
  39. #ifndef WINGDIAPI
  40. # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
  41. # define WINGDIAPI __declspec(dllimport)
  42. # elif defined(__LCC__)
  43. # define WINGDIAPI __stdcall
  44. # else
  45. # define WINGDIAPI extern
  46. # endif
  47. # define DGL_WINGDIAPI_DEFINED
  48. #endif // WINGDIAPI
  49. /* Some <GL/glu.h> files also need CALLBACK defined */
  50. #ifndef CALLBACK
  51. # if defined(_MSC_VER)
  52. # if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
  53. # define CALLBACK __stdcall
  54. # else
  55. # define CALLBACK
  56. # endif
  57. # else
  58. # define CALLBACK __stdcall
  59. # endif
  60. # define DGL_CALLBACK_DEFINED
  61. #endif // CALLBACK
  62. /* Most GL/glu.h variants on Windows need wchar_t */
  63. #include <cstddef>
  64. #endif // DISTRHO_OS_WINDOWS
  65. // -----------------------------------------------------------------------
  66. // OpenGL includes
  67. #ifndef HEADLESS
  68. # ifdef DISTRHO_OS_MAC
  69. # ifdef DGL_USE_OPENGL3
  70. # include <OpenGL/gl3.h>
  71. # include <OpenGL/gl3ext.h>
  72. # else
  73. # include <OpenGL/gl.h>
  74. # endif
  75. # else
  76. # ifdef DISTRHO_OS_WINDOWS
  77. # define GL_GLEXT_PROTOTYPES
  78. # endif
  79. # ifndef __GLEW_H__
  80. # include <GL/gl.h>
  81. # include <GL/glext.h>
  82. # endif
  83. # endif
  84. #endif
  85. // -----------------------------------------------------------------------
  86. // Missing OpenGL defines
  87. #if defined(GL_BGR_EXT) && !defined(GL_BGR)
  88. # define GL_BGR GL_BGR_EXT
  89. #endif
  90. #if defined(GL_BGRA_EXT) && !defined(GL_BGRA)
  91. # define GL_BGRA GL_BGRA_EXT
  92. #endif
  93. #ifndef GL_CLAMP_TO_BORDER
  94. # define GL_CLAMP_TO_BORDER 0x812D
  95. #endif
  96. // -----------------------------------------------------------------------
  97. // Fix OpenGL includes for Windows, based on glfw code (part 2)
  98. #ifdef DGL_CALLBACK_DEFINED
  99. # undef CALLBACK
  100. # undef DGL_CALLBACK_DEFINED
  101. #endif
  102. #ifdef DGL_WINGDIAPI_DEFINED
  103. # undef WINGDIAPI
  104. # undef DGL_WINGDIAPI_DEFINED
  105. #endif