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.

202 lines
6.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifdef __JUCE_OPENGL_JUCEHEADER__
  19. /* When you add this cpp file to your project, you mustn't include it in a file where you've
  20. already included any other headers - just put it inside a file on its own, possibly with your config
  21. flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
  22. header files that the compiler may be using.
  23. */
  24. #error "Incorrect use of JUCE cpp file"
  25. #endif
  26. // Your project must contain an AppConfig.h file with your project-specific settings in it,
  27. // and your header search path must make it accessible to the module's files.
  28. #include "AppConfig.h"
  29. #include "../juce_core/native/juce_BasicNativeHeaders.h"
  30. #include "juce_opengl.h"
  31. //==============================================================================
  32. #if JUCE_IOS
  33. #import <QuartzCore/QuartzCore.h>
  34. //==============================================================================
  35. #elif JUCE_WINDOWS
  36. #include <windowsx.h>
  37. #include <vfw.h>
  38. #include <commdlg.h>
  39. #if JUCE_WEB_BROWSER
  40. #include <Exdisp.h>
  41. #include <exdispid.h>
  42. #endif
  43. #if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  44. #pragma comment(lib, "vfw32.lib")
  45. #pragma comment(lib, "imm32.lib")
  46. #pragma comment(lib, "OpenGL32.Lib")
  47. #pragma comment(lib, "GlU32.Lib")
  48. #endif
  49. #if JUCE_QUICKTIME && JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  50. #pragma comment (lib, "QTMLClient.lib")
  51. #endif
  52. #if JUCE_DIRECT2D && JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  53. #pragma comment (lib, "Dwrite.lib")
  54. #pragma comment (lib, "D2d1.lib")
  55. #endif
  56. //==============================================================================
  57. #elif JUCE_LINUX
  58. #include <X11/Xlib.h>
  59. #include <X11/Xatom.h>
  60. #include <X11/Xresource.h>
  61. #include <X11/Xutil.h>
  62. #include <X11/Xmd.h>
  63. #include <X11/keysym.h>
  64. #include <X11/cursorfont.h>
  65. #if JUCE_USE_XINERAMA
  66. /* If you're trying to use Xinerama, you'll need to install the "libxinerama-dev" package.. */
  67. #include <X11/extensions/Xinerama.h>
  68. #endif
  69. #if JUCE_USE_XSHM
  70. #include <X11/extensions/XShm.h>
  71. #include <sys/shm.h>
  72. #include <sys/ipc.h>
  73. #endif
  74. #if JUCE_USE_XRENDER
  75. // If you're missing these headers, try installing the libxrender-dev and libxcomposite-dev
  76. #include <X11/extensions/Xrender.h>
  77. #include <X11/extensions/Xcomposite.h>
  78. #endif
  79. #if JUCE_USE_XCURSOR
  80. // If you're missing this header, try installing the libxcursor-dev package
  81. #include <X11/Xcursor/Xcursor.h>
  82. #endif
  83. /* Got an include error here?
  84. If you want to install OpenGL support, the packages to get are "mesa-common-dev"
  85. and "freeglut3-dev".
  86. */
  87. #include <GL/glx.h>
  88. #undef SIZEOF
  89. #undef KeyPress
  90. //==============================================================================
  91. #elif JUCE_ANDROID
  92. #ifndef GL_GLEXT_PROTOTYPES
  93. #define GL_GLEXT_PROTOTYPES 1
  94. #endif
  95. #include <GLES/glext.h>
  96. #include <GLES2/gl2.h>
  97. #endif
  98. namespace juce
  99. {
  100. //==============================================================================
  101. #include "native/juce_MissingGLDefinitions.h"
  102. #include "native/juce_OpenGLExtensions.h"
  103. void OpenGLExtensionFunctions::initialise()
  104. {
  105. #if JUCE_WINDOWS || JUCE_LINUX
  106. #define JUCE_INIT_GL_FUNCTION(name, returnType, params, callparams) name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name);
  107. JUCE_GL_EXTENSION_FUNCTIONS (JUCE_INIT_GL_FUNCTION)
  108. #undef JUCE_INIT_GL_FUNCTION
  109. #endif
  110. }
  111. #if JUCE_OPENGL_ES
  112. #define JUCE_DECLARE_GL_FUNCTION(name, returnType, params, callparams) inline returnType OpenGLExtensionFunctions::name params { return ::name callparams; }
  113. JUCE_GL_EXTENSION_FUNCTIONS (JUCE_DECLARE_GL_FUNCTION)
  114. #undef JUCE_DECLARE_GL_FUNCTION
  115. #endif
  116. #undef JUCE_GL_EXTENSION_FUNCTIONS
  117. #if JUCE_OPENGL_ES
  118. #define JUCE_LOWP "lowp"
  119. #define JUCE_MEDIUMP "mediump"
  120. #define JUCE_HIGHP "highp"
  121. #else
  122. #define JUCE_LOWP
  123. #define JUCE_MEDIUMP
  124. #define JUCE_HIGHP
  125. #endif
  126. //==============================================================================
  127. // START_AUTOINCLUDE opengl/*.cpp
  128. #include "opengl/juce_OpenGLComponent.cpp"
  129. #include "opengl/juce_OpenGLContext.cpp"
  130. #include "opengl/juce_OpenGLFrameBuffer.cpp"
  131. #include "opengl/juce_OpenGLGraphicsContext.cpp"
  132. #include "opengl/juce_OpenGLHelpers.cpp"
  133. #include "opengl/juce_OpenGLImage.cpp"
  134. #include "opengl/juce_OpenGLShaderProgram.cpp"
  135. #include "opengl/juce_OpenGLTexture.cpp"
  136. // END_AUTOINCLUDE
  137. }
  138. using namespace juce;
  139. namespace juce
  140. {
  141. //==============================================================================
  142. #if JUCE_MAC || JUCE_IOS
  143. #include "../juce_core/native/juce_osx_ObjCHelpers.h"
  144. #include "../juce_core/native/juce_mac_ObjCSuffix.h"
  145. #include "../juce_graphics/native/juce_mac_CoreGraphicsHelpers.h"
  146. #if JUCE_MAC
  147. #include "native/juce_mac_OpenGLComponent.mm"
  148. #else
  149. #include "native/juce_ios_OpenGLComponent.mm"
  150. #endif
  151. #elif JUCE_WINDOWS
  152. #include "native/juce_win32_OpenGLComponent.cpp"
  153. #elif JUCE_LINUX
  154. #include "native/juce_linux_OpenGLComponent.cpp"
  155. #elif JUCE_ANDROID
  156. #include "../juce_core/native/juce_android_JNIHelpers.h"
  157. #include "native/juce_android_OpenGLComponent.cpp"
  158. #endif
  159. }