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.

74 lines
2.6KB

  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_OPENGLTEXTURE_JUCEHEADER__
  19. #define __JUCE_OPENGLTEXTURE_JUCEHEADER__
  20. /**
  21. Creates an openGL texture from an Image.
  22. */
  23. class JUCE_API OpenGLTexture
  24. {
  25. public:
  26. OpenGLTexture();
  27. ~OpenGLTexture();
  28. /** Creates a texture from the given image.
  29. Note that the image's width and height must both be a power-of-two.
  30. */
  31. void load (const Image& image);
  32. /** Frees the texture, if there is one. */
  33. void release();
  34. /** Binds the texture to the currently selected openGL context. */
  35. void bind() const;
  36. /** Unbinds the texture to the currently selected openGL context. */
  37. void unbind() const;
  38. /** Draws this texture into the current context, with the specified corner positions. */
  39. void draw2D (float x1, float y1,
  40. float x2, float y2,
  41. float x3, float y3,
  42. float x4, float y4,
  43. const Colour& colour) const;
  44. /** Draws this texture into the current context, with the specified corner positions. */
  45. void draw3D (float x1, float y1, float z1,
  46. float x2, float y2, float z2,
  47. float x3, float y3, float z3,
  48. float x4, float y4, float z4,
  49. const Colour& colour) const;
  50. private:
  51. unsigned int textureID;
  52. int width, height;
  53. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLTexture);
  54. };
  55. #endif // __JUCE_OPENGLTEXTURE_JUCEHEADER__