qopengltexture.sip 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. // qopengltexture.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 QOpenGLTexture
  22. {
  23. %TypeHeaderCode
  24. #include <qopengltexture.h>
  25. %End
  26. public:
  27. enum Target
  28. {
  29. Target1D,
  30. Target1DArray,
  31. Target2D,
  32. Target2DArray,
  33. Target3D,
  34. TargetCubeMap,
  35. TargetCubeMapArray,
  36. Target2DMultisample,
  37. Target2DMultisampleArray,
  38. TargetRectangle,
  39. TargetBuffer,
  40. };
  41. enum BindingTarget
  42. {
  43. BindingTarget1D,
  44. BindingTarget1DArray,
  45. BindingTarget2D,
  46. BindingTarget2DArray,
  47. BindingTarget3D,
  48. BindingTargetCubeMap,
  49. BindingTargetCubeMapArray,
  50. BindingTarget2DMultisample,
  51. BindingTarget2DMultisampleArray,
  52. BindingTargetRectangle,
  53. BindingTargetBuffer,
  54. };
  55. enum MipMapGeneration
  56. {
  57. GenerateMipMaps,
  58. DontGenerateMipMaps,
  59. };
  60. enum TextureUnitReset
  61. {
  62. ResetTextureUnit,
  63. DontResetTextureUnit,
  64. };
  65. explicit QOpenGLTexture(QOpenGLTexture::Target target);
  66. QOpenGLTexture(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps);
  67. ~QOpenGLTexture();
  68. bool create();
  69. void destroy();
  70. bool isCreated() const;
  71. GLuint textureId() const;
  72. void bind();
  73. void bind(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
  74. void release();
  75. void release(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
  76. bool isBound() const;
  77. bool isBound(uint unit);
  78. static GLuint boundTextureId(QOpenGLTexture::BindingTarget target);
  79. static GLuint boundTextureId(uint unit, QOpenGLTexture::BindingTarget target);
  80. enum TextureFormat
  81. {
  82. NoFormat,
  83. R8_UNorm,
  84. RG8_UNorm,
  85. RGB8_UNorm,
  86. RGBA8_UNorm,
  87. R16_UNorm,
  88. RG16_UNorm,
  89. RGB16_UNorm,
  90. RGBA16_UNorm,
  91. R8_SNorm,
  92. RG8_SNorm,
  93. RGB8_SNorm,
  94. RGBA8_SNorm,
  95. R16_SNorm,
  96. RG16_SNorm,
  97. RGB16_SNorm,
  98. RGBA16_SNorm,
  99. R8U,
  100. RG8U,
  101. RGB8U,
  102. RGBA8U,
  103. R16U,
  104. RG16U,
  105. RGB16U,
  106. RGBA16U,
  107. R32U,
  108. RG32U,
  109. RGB32U,
  110. RGBA32U,
  111. R8I,
  112. RG8I,
  113. RGB8I,
  114. RGBA8I,
  115. R16I,
  116. RG16I,
  117. RGB16I,
  118. RGBA16I,
  119. R32I,
  120. RG32I,
  121. RGB32I,
  122. RGBA32I,
  123. R16F,
  124. RG16F,
  125. RGB16F,
  126. RGBA16F,
  127. R32F,
  128. RG32F,
  129. RGB32F,
  130. RGBA32F,
  131. RGB9E5,
  132. RG11B10F,
  133. RG3B2,
  134. R5G6B5,
  135. RGB5A1,
  136. RGBA4,
  137. RGB10A2,
  138. D16,
  139. D24,
  140. D24S8,
  141. D32,
  142. D32F,
  143. D32FS8X24,
  144. RGB_DXT1,
  145. RGBA_DXT1,
  146. RGBA_DXT3,
  147. RGBA_DXT5,
  148. R_ATI1N_UNorm,
  149. R_ATI1N_SNorm,
  150. RG_ATI2N_UNorm,
  151. RG_ATI2N_SNorm,
  152. RGB_BP_UNSIGNED_FLOAT,
  153. RGB_BP_SIGNED_FLOAT,
  154. RGB_BP_UNorm,
  155. SRGB8,
  156. SRGB8_Alpha8,
  157. SRGB_DXT1,
  158. SRGB_Alpha_DXT1,
  159. SRGB_Alpha_DXT3,
  160. SRGB_Alpha_DXT5,
  161. SRGB_BP_UNorm,
  162. DepthFormat,
  163. AlphaFormat,
  164. RGBFormat,
  165. RGBAFormat,
  166. LuminanceFormat,
  167. LuminanceAlphaFormat,
  168. S8,
  169. R11_EAC_UNorm,
  170. R11_EAC_SNorm,
  171. RG11_EAC_UNorm,
  172. RG11_EAC_SNorm,
  173. RGB8_ETC2,
  174. SRGB8_ETC2,
  175. RGB8_PunchThrough_Alpha1_ETC2,
  176. SRGB8_PunchThrough_Alpha1_ETC2,
  177. RGBA8_ETC2_EAC,
  178. SRGB8_Alpha8_ETC2_EAC,
  179. RGB8_ETC1,
  180. RGBA_ASTC_4x4,
  181. RGBA_ASTC_5x4,
  182. RGBA_ASTC_5x5,
  183. RGBA_ASTC_6x5,
  184. RGBA_ASTC_6x6,
  185. RGBA_ASTC_8x5,
  186. RGBA_ASTC_8x6,
  187. RGBA_ASTC_8x8,
  188. RGBA_ASTC_10x5,
  189. RGBA_ASTC_10x6,
  190. RGBA_ASTC_10x8,
  191. RGBA_ASTC_10x10,
  192. RGBA_ASTC_12x10,
  193. RGBA_ASTC_12x12,
  194. SRGB8_Alpha8_ASTC_4x4,
  195. SRGB8_Alpha8_ASTC_5x4,
  196. SRGB8_Alpha8_ASTC_5x5,
  197. SRGB8_Alpha8_ASTC_6x5,
  198. SRGB8_Alpha8_ASTC_6x6,
  199. SRGB8_Alpha8_ASTC_8x5,
  200. SRGB8_Alpha8_ASTC_8x6,
  201. SRGB8_Alpha8_ASTC_8x8,
  202. SRGB8_Alpha8_ASTC_10x5,
  203. SRGB8_Alpha8_ASTC_10x6,
  204. SRGB8_Alpha8_ASTC_10x8,
  205. SRGB8_Alpha8_ASTC_10x10,
  206. SRGB8_Alpha8_ASTC_12x10,
  207. SRGB8_Alpha8_ASTC_12x12,
  208. };
  209. void setFormat(QOpenGLTexture::TextureFormat format);
  210. QOpenGLTexture::TextureFormat format() const;
  211. void setSize(int width, int height = 1, int depth = 1);
  212. int width() const;
  213. int height() const;
  214. int depth() const;
  215. void setMipLevels(int levels);
  216. int mipLevels() const;
  217. int maximumMipLevels() const;
  218. void setLayers(int layers);
  219. int layers() const;
  220. int faces() const;
  221. void allocateStorage();
  222. void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType);
  223. bool isStorageAllocated() const;
  224. QOpenGLTexture *createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const /Factory/;
  225. bool isTextureView() const;
  226. enum CubeMapFace
  227. {
  228. CubeMapPositiveX,
  229. CubeMapNegativeX,
  230. CubeMapPositiveY,
  231. CubeMapNegativeY,
  232. CubeMapPositiveZ,
  233. CubeMapNegativeZ,
  234. };
  235. enum PixelFormat
  236. {
  237. NoSourceFormat,
  238. Red,
  239. RG,
  240. RGB,
  241. BGR,
  242. RGBA,
  243. BGRA,
  244. Red_Integer,
  245. RG_Integer,
  246. RGB_Integer,
  247. BGR_Integer,
  248. RGBA_Integer,
  249. BGRA_Integer,
  250. Depth,
  251. DepthStencil,
  252. Alpha,
  253. Luminance,
  254. LuminanceAlpha,
  255. Stencil,
  256. };
  257. enum PixelType
  258. {
  259. NoPixelType,
  260. Int8,
  261. UInt8,
  262. Int16,
  263. UInt16,
  264. Int32,
  265. UInt32,
  266. Float16,
  267. Float16OES,
  268. Float32,
  269. UInt32_RGB9_E5,
  270. UInt32_RG11B10F,
  271. UInt8_RG3B2,
  272. UInt8_RG3B2_Rev,
  273. UInt16_RGB5A1,
  274. UInt16_RGB5A1_Rev,
  275. UInt16_R5G6B5,
  276. UInt16_R5G6B5_Rev,
  277. UInt16_RGBA4,
  278. UInt16_RGBA4_Rev,
  279. UInt32_RGB10A2,
  280. UInt32_RGB10A2_Rev,
  281. UInt32_RGBA8,
  282. UInt32_RGBA8_Rev,
  283. UInt32_D24S8,
  284. Float32_D32_UInt32_S8_X24,
  285. };
  286. void setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  287. void setData(int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  288. void setData(int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  289. void setData(QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  290. void setData(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps);
  291. void setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  292. void setCompressedData(int mipLevel, int layer, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  293. void setCompressedData(int mipLevel, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  294. void setCompressedData(int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  295. enum Feature /BaseType=Flag/
  296. {
  297. ImmutableStorage,
  298. ImmutableMultisampleStorage,
  299. TextureRectangle,
  300. TextureArrays,
  301. Texture3D,
  302. TextureMultisample,
  303. TextureBuffer,
  304. TextureCubeMapArrays,
  305. Swizzle,
  306. StencilTexturing,
  307. AnisotropicFiltering,
  308. NPOTTextures,
  309. NPOTTextureRepeat,
  310. Texture1D,
  311. TextureComparisonOperators,
  312. TextureMipMapLevel,
  313. };
  314. typedef QFlags<QOpenGLTexture::Feature> Features;
  315. static bool hasFeature(QOpenGLTexture::Feature feature);
  316. void setMipBaseLevel(int baseLevel);
  317. int mipBaseLevel() const;
  318. void setMipMaxLevel(int maxLevel);
  319. int mipMaxLevel() const;
  320. void setMipLevelRange(int baseLevel, int maxLevel);
  321. std::pair<int, int> mipLevelRange() const;
  322. void setAutoMipMapGenerationEnabled(bool enabled);
  323. bool isAutoMipMapGenerationEnabled() const;
  324. void generateMipMaps();
  325. void generateMipMaps(int baseLevel, bool resetBaseLevel = true);
  326. enum SwizzleComponent
  327. {
  328. SwizzleRed,
  329. SwizzleGreen,
  330. SwizzleBlue,
  331. SwizzleAlpha,
  332. };
  333. enum SwizzleValue
  334. {
  335. RedValue,
  336. GreenValue,
  337. BlueValue,
  338. AlphaValue,
  339. ZeroValue,
  340. OneValue,
  341. };
  342. void setSwizzleMask(QOpenGLTexture::SwizzleComponent component, QOpenGLTexture::SwizzleValue value);
  343. void setSwizzleMask(QOpenGLTexture::SwizzleValue r, QOpenGLTexture::SwizzleValue g, QOpenGLTexture::SwizzleValue b, QOpenGLTexture::SwizzleValue a);
  344. QOpenGLTexture::SwizzleValue swizzleMask(QOpenGLTexture::SwizzleComponent component) const;
  345. enum DepthStencilMode
  346. {
  347. DepthMode,
  348. StencilMode,
  349. };
  350. void setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode);
  351. QOpenGLTexture::DepthStencilMode depthStencilMode() const;
  352. enum Filter
  353. {
  354. Nearest,
  355. Linear,
  356. NearestMipMapNearest,
  357. NearestMipMapLinear,
  358. LinearMipMapNearest,
  359. LinearMipMapLinear,
  360. };
  361. void setMinificationFilter(QOpenGLTexture::Filter filter);
  362. QOpenGLTexture::Filter minificationFilter() const;
  363. void setMagnificationFilter(QOpenGLTexture::Filter filter);
  364. QOpenGLTexture::Filter magnificationFilter() const;
  365. void setMinMagFilters(QOpenGLTexture::Filter minificationFilter, QOpenGLTexture::Filter magnificationFilter);
  366. std::pair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> minMagFilters() const;
  367. void setMaximumAnisotropy(float anisotropy);
  368. float maximumAnisotropy() const;
  369. enum WrapMode
  370. {
  371. Repeat,
  372. MirroredRepeat,
  373. ClampToEdge,
  374. ClampToBorder,
  375. };
  376. enum CoordinateDirection
  377. {
  378. DirectionS,
  379. DirectionT,
  380. DirectionR,
  381. };
  382. void setWrapMode(QOpenGLTexture::WrapMode mode);
  383. void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode);
  384. QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const;
  385. void setBorderColor(const QColor &color);
  386. QColor borderColor() const;
  387. void setMinimumLevelOfDetail(float value);
  388. float minimumLevelOfDetail() const;
  389. void setMaximumLevelOfDetail(float value);
  390. float maximumLevelOfDetail() const;
  391. void setLevelOfDetailRange(float min, float max);
  392. std::pair<float, float> levelOfDetailRange() const;
  393. void setLevelofDetailBias(float bias);
  394. float levelofDetailBias() const;
  395. QOpenGLTexture::Target target() const;
  396. void setSamples(int samples);
  397. int samples() const;
  398. void setFixedSamplePositions(bool fixed);
  399. bool isFixedSamplePositions() const;
  400. enum ComparisonFunction
  401. {
  402. CompareLessEqual,
  403. CompareGreaterEqual,
  404. CompareLess,
  405. CompareGreater,
  406. CompareEqual,
  407. CommpareNotEqual,
  408. CompareAlways,
  409. CompareNever,
  410. %If (Qt_6_1_0 -)
  411. CompareNotEqual,
  412. %End
  413. };
  414. void setComparisonFunction(QOpenGLTexture::ComparisonFunction function);
  415. QOpenGLTexture::ComparisonFunction comparisonFunction() const;
  416. enum ComparisonMode
  417. {
  418. CompareRefToTexture,
  419. CompareNone,
  420. };
  421. void setComparisonMode(QOpenGLTexture::ComparisonMode mode);
  422. QOpenGLTexture::ComparisonMode comparisonMode() const;
  423. void setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  424. void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  425. void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  426. void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  427. void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  428. void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  429. void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int layerCount, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
  430. private:
  431. QOpenGLTexture(const QOpenGLTexture &);
  432. };