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.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  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. //==============================================================================
  16. /**
  17. A base class that should be implemented by classes which want to render openGL
  18. on a background thread.
  19. @see OpenGLContext
  20. @tags{OpenGL}
  21. */
  22. class JUCE_API OpenGLRenderer
  23. {
  24. public:
  25. OpenGLRenderer() = default;
  26. virtual ~OpenGLRenderer() = default;
  27. /** Called when a new GL context has been created.
  28. You can use this as an opportunity to create your textures, shaders, etc.
  29. When the method is invoked, the new GL context will be active.
  30. Note that this callback will be made on a background thread, so make sure
  31. that your implementation is thread-safe.
  32. */
  33. virtual void newOpenGLContextCreated() = 0;
  34. /** Called when you should render the next openGL frame.
  35. Note that this callback will be made on a background thread.
  36. If the context is attached to a component in order to do component rendering,
  37. then the MessageManager will be locked when this callback is made.
  38. If no component rendering is being done, then the MessageManager will not be
  39. locked, and you'll need to make sure your code is thread-safe in any
  40. interactions it has with your GUI classes.
  41. For information about how to trigger a render callback, see
  42. OpenGLContext::triggerRepaint() and OpenGLContext::setContinuousRepainting().
  43. */
  44. virtual void renderOpenGL() = 0;
  45. /** Called when the current openGL context is about to close.
  46. You can use this opportunity to release any GL resources that you may have
  47. created.
  48. Note that this callback will be made on a background thread, so make sure
  49. that your implementation is thread-safe.
  50. (Also note that on Android, this callback won't happen, because there's currently
  51. no way to implement it..)
  52. */
  53. virtual void openGLContextClosing() = 0;
  54. };
  55. } // namespace juce