The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

134 lines
4.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 7 technical preview.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For the technical preview this file cannot be licensed commercially.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. /** @internal This macro contains a list of GL extension functions that need to be dynamically loaded on Windows/Linux.
  16. @see OpenGLExtensionFunctions
  17. */
  18. #define JUCE_GL_BASE_FUNCTIONS \
  19. X (glActiveTexture) \
  20. X (glBindBuffer) \
  21. X (glDeleteBuffers) \
  22. X (glGenBuffers) \
  23. X (glBufferData) \
  24. X (glBufferSubData) \
  25. X (glCreateProgram) \
  26. X (glDeleteProgram) \
  27. X (glCreateShader) \
  28. X (glDeleteShader) \
  29. X (glShaderSource) \
  30. X (glCompileShader) \
  31. X (glAttachShader) \
  32. X (glLinkProgram) \
  33. X (glUseProgram) \
  34. X (glGetShaderiv) \
  35. X (glGetShaderInfoLog) \
  36. X (glGetProgramInfoLog) \
  37. X (glGetProgramiv) \
  38. X (glGetUniformLocation) \
  39. X (glGetAttribLocation) \
  40. X (glVertexAttribPointer) \
  41. X (glEnableVertexAttribArray) \
  42. X (glDisableVertexAttribArray) \
  43. X (glUniform1f) \
  44. X (glUniform1i) \
  45. X (glUniform2f) \
  46. X (glUniform3f) \
  47. X (glUniform4f) \
  48. X (glUniform4i) \
  49. X (glUniform1fv) \
  50. X (glUniformMatrix2fv) \
  51. X (glUniformMatrix3fv) \
  52. X (glUniformMatrix4fv) \
  53. X (glBindAttribLocation)
  54. /** @internal This macro contains a list of GL extension functions that need to be dynamically loaded on Windows/Linux.
  55. @see OpenGLExtensionFunctions
  56. */
  57. #define JUCE_GL_EXTENSION_FUNCTIONS \
  58. X (glIsRenderbuffer) \
  59. X (glBindRenderbuffer) \
  60. X (glDeleteRenderbuffers) \
  61. X (glGenRenderbuffers) \
  62. X (glRenderbufferStorage) \
  63. X (glGetRenderbufferParameteriv) \
  64. X (glIsFramebuffer) \
  65. X (glBindFramebuffer) \
  66. X (glDeleteFramebuffers) \
  67. X (glGenFramebuffers) \
  68. X (glCheckFramebufferStatus) \
  69. X (glFramebufferTexture2D) \
  70. X (glFramebufferRenderbuffer) \
  71. X (glGetFramebufferAttachmentParameteriv)
  72. /** @internal This macro contains a list of GL extension functions that need to be dynamically loaded on Windows/Linux.
  73. @see OpenGLExtensionFunctions
  74. */
  75. #define JUCE_GL_VERTEXBUFFER_FUNCTIONS \
  76. X (glGenVertexArrays) \
  77. X (glDeleteVertexArrays) \
  78. X (glBindVertexArray)
  79. /** This class contains a generated list of OpenGL extension functions, which are either dynamically loaded
  80. for a specific GL context, or simply call-through to the appropriate OS function where available.
  81. This class is provided for backwards compatibility. In new code, you should prefer to use
  82. functions from the juce::gl namespace. By importing all these symbols with
  83. `using namespace ::juce::gl;`, all GL enumerations and functions will be made available at
  84. global scope. This may be helpful if you need to write code with C source compatibility, or
  85. which is compatible with a different extension-loading library.
  86. All the normal guidance about `using namespace` should still apply - don't do this in a header,
  87. or at all if you can possibly avoid it!
  88. @tags{OpenGL}
  89. */
  90. struct OpenGLExtensionFunctions
  91. {
  92. //==============================================================================
  93. #ifndef DOXYGEN
  94. [[deprecated ("A more complete set of GL commands can be found in the juce::gl namespace. "
  95. "You should use juce::gl::loadFunctions() to load GL functions.")]]
  96. static void initialise();
  97. #endif
  98. #if JUCE_WINDOWS && ! defined (DOXYGEN)
  99. typedef char GLchar;
  100. typedef pointer_sized_int GLsizeiptr;
  101. typedef pointer_sized_int GLintptr;
  102. #endif
  103. #define X(name) static decltype (::juce::gl::name)& name;
  104. JUCE_GL_BASE_FUNCTIONS
  105. JUCE_GL_EXTENSION_FUNCTIONS
  106. JUCE_GL_VERTEXBUFFER_FUNCTIONS
  107. #undef X
  108. };
  109. enum MissingOpenGLDefinitions
  110. {
  111. #if JUCE_ANDROID
  112. JUCE_RGBA_FORMAT = ::juce::gl::GL_RGBA,
  113. #else
  114. JUCE_RGBA_FORMAT = ::juce::gl::GL_BGRA_EXT,
  115. #endif
  116. };
  117. } // namespace juce