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.

75 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_OPENGLRENDERER_H_INCLUDED
  18. #define JUCE_OPENGLRENDERER_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. A base class that should be implemented by classes which want to render openGL
  22. on a background thread.
  23. @see OpenGLContext
  24. */
  25. class JUCE_API OpenGLRenderer
  26. {
  27. public:
  28. OpenGLRenderer() {}
  29. virtual ~OpenGLRenderer() {}
  30. /** Called when a new GL context has been created.
  31. You can use this as an opportunity to create your textures, shaders, etc.
  32. When the method is invoked, the new GL context will be active.
  33. Note that this callback will be made on a background thread, so make sure
  34. that your implementation is thread-safe.
  35. */
  36. virtual void newOpenGLContextCreated() = 0;
  37. /** Called when you should render the next openGL frame.
  38. Note that this callback will be made on a background thread, not the message
  39. thread, so make sure that your implementation is thread-safe.
  40. If the context is attached to a component in order to do component rendering,
  41. then the MessageManager may be locked when this callback is made.
  42. For information about how to trigger a render callback, see
  43. OpenGLContext::triggerRepaint() and OpenGLContext::setContinuousRepainting().
  44. */
  45. virtual void renderOpenGL() = 0;
  46. /** Called when the current openGL context is about to close.
  47. You can use this opportunity to release any GL resources that you may have
  48. created.
  49. Note that this callback will be made on a background thread, so make sure
  50. that your implementation is thread-safe.
  51. (Also note that on Android, this callback won't happen, because there's currently
  52. no way to implement it..)
  53. */
  54. virtual void openGLContextClosing() = 0;
  55. };
  56. #endif // JUCE_OPENGLRENDERER_H_INCLUDED