qopenglframebufferobject.sip 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // qopenglframebufferobject.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtOpenGL Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QOpenGLFramebufferObject
  22. {
  23. %TypeHeaderCode
  24. #include <qopenglframebufferobject.h>
  25. %End
  26. %TypeCode
  27. // The defaults are different for desktop OpenGL and OpenGL/ES so pretend the
  28. // latter is the former.
  29. #if defined(QT_OPENGL_ES)
  30. #undef GL_RGBA8
  31. #define GL_RGBA8 GL_RGBA
  32. #endif
  33. %End
  34. public:
  35. enum Attachment
  36. {
  37. NoAttachment,
  38. CombinedDepthStencil,
  39. Depth,
  40. };
  41. QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D);
  42. QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D);
  43. QOpenGLFramebufferObject(const QSize &size, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8);
  44. QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8);
  45. QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format);
  46. QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format);
  47. virtual ~QOpenGLFramebufferObject();
  48. QOpenGLFramebufferObjectFormat format() const;
  49. bool isValid() const;
  50. bool isBound() const;
  51. bool bind();
  52. bool release();
  53. int width() const;
  54. int height() const;
  55. GLuint texture() const;
  56. QList<unsigned int> textures() const;
  57. QSize size() const;
  58. QImage toImage(bool flipped = true) const;
  59. QImage toImage(bool flipped, int colorAttachmentIndex) const;
  60. QOpenGLFramebufferObject::Attachment attachment() const;
  61. void setAttachment(QOpenGLFramebufferObject::Attachment attachment);
  62. GLuint handle() const;
  63. static bool bindDefault();
  64. static bool hasOpenGLFramebufferObjects();
  65. static bool hasOpenGLFramebufferBlit();
  66. enum FramebufferRestorePolicy
  67. {
  68. DontRestoreFramebufferBinding,
  69. RestoreFramebufferBindingToDefault,
  70. RestoreFrameBufferBinding,
  71. };
  72. static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
  73. static void blitFramebuffer(QOpenGLFramebufferObject *target, QOpenGLFramebufferObject *source, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
  74. static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex);
  75. static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy);
  76. GLuint takeTexture();
  77. GLuint takeTexture(int colorAttachmentIndex);
  78. void addColorAttachment(const QSize &size, GLenum internal_format = 0);
  79. void addColorAttachment(int width, int height, GLenum internal_format = 0);
  80. QList<QSize> sizes() const;
  81. private:
  82. QOpenGLFramebufferObject(const QOpenGLFramebufferObject &);
  83. };
  84. class QOpenGLFramebufferObjectFormat
  85. {
  86. %TypeHeaderCode
  87. #include <qopenglframebufferobject.h>
  88. %End
  89. public:
  90. QOpenGLFramebufferObjectFormat();
  91. QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other);
  92. ~QOpenGLFramebufferObjectFormat();
  93. void setSamples(int samples);
  94. int samples() const;
  95. void setMipmap(bool enabled);
  96. bool mipmap() const;
  97. void setAttachment(QOpenGLFramebufferObject::Attachment attachment);
  98. QOpenGLFramebufferObject::Attachment attachment() const;
  99. void setTextureTarget(GLenum target);
  100. GLenum textureTarget() const;
  101. void setInternalTextureFormat(GLenum internalTextureFormat);
  102. GLenum internalTextureFormat() const;
  103. bool operator==(const QOpenGLFramebufferObjectFormat &other) const;
  104. bool operator!=(const QOpenGLFramebufferObjectFormat &other) const;
  105. };