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.

86 lines
3.0KB

  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. #ifndef __JUCE_OPENGLFRAMEBUFFER_JUCEHEADER__
  19. #define __JUCE_OPENGLFRAMEBUFFER_JUCEHEADER__
  20. //==============================================================================
  21. /**
  22. Creates an openGL frame buffer.
  23. */
  24. class JUCE_API OpenGLFrameBuffer
  25. {
  26. public:
  27. /** Creates an uninitialised buffer.
  28. To actually allocate the buffer, use initialise().
  29. */
  30. OpenGLFrameBuffer();
  31. /** Destructor. */
  32. ~OpenGLFrameBuffer();
  33. //==============================================================================
  34. /** Tries to allocates a buffer of the given size.
  35. Note that a valid openGL context must be selected when you call this method,
  36. or it will fail.
  37. */
  38. bool initialise (int width, int height);
  39. /** Releases the buffer, if one has been allocated. */
  40. void release();
  41. /** Returns true if a valid buffer has been allocated. */
  42. bool isValid() const noexcept { return pimpl != nullptr; }
  43. /** Returns the width of the buffer. */
  44. int getWidth() const noexcept;
  45. /** Returns the height of the buffer. */
  46. int getHeight() const noexcept;
  47. /** Returns the texture ID number for using this buffer as a texture. */
  48. unsigned int getTextureID() const noexcept;
  49. //==============================================================================
  50. /** Selects this buffer as the current OpenGL rendering target. */
  51. bool makeCurrentTarget();
  52. /** Deselects this buffer as the current OpenGL rendering target. */
  53. void releaseCurrentTarget();
  54. void clear (const Colour& colour);
  55. private:
  56. class Pimpl;
  57. friend class ScopedPointer<Pimpl>;
  58. ScopedPointer<Pimpl> pimpl;
  59. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLFrameBuffer);
  60. };
  61. #endif // __JUCE_OPENGLFRAMEBUFFER_JUCEHEADER__