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.

83 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  23. A base class that should be implemented by classes which want to render openGL
  24. on a background thread.
  25. @see OpenGLContext
  26. @tags{OpenGL}
  27. */
  28. class JUCE_API OpenGLRenderer
  29. {
  30. public:
  31. OpenGLRenderer() {}
  32. virtual ~OpenGLRenderer() {}
  33. /** Called when a new GL context has been created.
  34. You can use this as an opportunity to create your textures, shaders, etc.
  35. When the method is invoked, the new GL context will be active.
  36. Note that this callback will be made on a background thread, so make sure
  37. that your implementation is thread-safe.
  38. */
  39. virtual void newOpenGLContextCreated() = 0;
  40. /** Called when you should render the next openGL frame.
  41. Note that this callback will be made on a background thread.
  42. If the context is attached to a component in order to do component rendering,
  43. then the MessageManager will be locked when this callback is made.
  44. If no component rendering is being done, then the MessageManager will not be
  45. locked, and you'll need to make sure your code is thread-safe in any
  46. interactions it has with your GUI classes.
  47. For information about how to trigger a render callback, see
  48. OpenGLContext::triggerRepaint() and OpenGLContext::setContinuousRepainting().
  49. */
  50. virtual void renderOpenGL() = 0;
  51. /** Called when the current openGL context is about to close.
  52. You can use this opportunity to release any GL resources that you may have
  53. created.
  54. Note that this callback will be made on a background thread, so make sure
  55. that your implementation is thread-safe.
  56. (Also note that on Android, this callback won't happen, because there's currently
  57. no way to implement it..)
  58. */
  59. virtual void openGLContextClosing() = 0;
  60. };
  61. } // namespace juce