Fix tray visibility and message reception issues
Some checks failed
build / build-win64 (push) Waiting to run
build / build-macos (push) Waiting to run
build / build-pip (push) Failing after 16s

- Disable sound initialization to prevent hanging
- Add missing import re in utils.py
- Fix settings loading for QSettings
- Update file paths to use PROJECT_ROOT
- Revert to working API paths and listener from commit efdc63e
This commit is contained in:
kdusek
2025-12-07 22:39:07 +01:00
parent 7b695d7b7f
commit 5138303016
4060 changed files with 579123 additions and 23 deletions

View File

@@ -0,0 +1,6 @@
# Automatically generated configuration for PyQt6.QtOpenGL.
sip-version = "6.14.0"
sip-abi-version = "13.8"
module-tags = ["Qt_6_10_0", "Linux"]
module-disabled-features = ["PyQt_OpenGL_ES2"]

View File

@@ -0,0 +1,68 @@
// QtOpenGLmod.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%Module(name=PyQt6.QtOpenGL, keyword_arguments="Optional", use_limited_api=True)
%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
%Copying
Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
This file is part of PyQt6.
This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and appearing in
the file LICENSE included in the packaging of this file. Please review the
following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you do not wish to use this file under the terms of the GPL version 3.0
then you may purchase a commercial license. For more information contact
info@riverbankcomputing.com.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%End
%DefaultSupertype PyQt6.sip.simplewrapper
%Include qopenglbuffer.sip
%Include qopengldebug.sip
%Include qopenglframebufferobject.sip
%Include qopenglpaintdevice.sip
%Include qopenglpixeltransferoptions.sip
%Include qopenglshaderprogram.sip
%Include qopengltexture.sip
%Include qopengltextureblitter.sip
%Include qopengltimerquery.sip
%Include qopenglversionfunctions.sip
%Include qopenglversionfunctionsfactory.sip
%Include qopenglvertexarrayobject.sip
%Include qopenglwindow.sip
%Include qopenglfunctions_2_0.sip
%Include qopenglfunctions_2_1.sip
%Include qopenglfunctions_4_1_core.sip
%Include qopenglfunctions_es2.sip
%Include qopenglversionprofile.sip
%Include qpyopengl_qlist.sip
%Include qpyopengl_std_pair.sip

View File

@@ -0,0 +1,96 @@
// qopenglbuffer.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLBuffer
{
%TypeHeaderCode
#include <qopenglbuffer.h>
%End
public:
enum Type
{
VertexBuffer,
IndexBuffer,
PixelPackBuffer,
PixelUnpackBuffer,
};
QOpenGLBuffer();
explicit QOpenGLBuffer(QOpenGLBuffer::Type type);
QOpenGLBuffer(const QOpenGLBuffer &other);
~QOpenGLBuffer();
enum UsagePattern
{
StreamDraw,
StreamRead,
StreamCopy,
StaticDraw,
StaticRead,
StaticCopy,
DynamicDraw,
DynamicRead,
DynamicCopy,
};
enum Access
{
ReadOnly,
WriteOnly,
ReadWrite,
};
QOpenGLBuffer::Type type() const;
QOpenGLBuffer::UsagePattern usagePattern() const;
void setUsagePattern(QOpenGLBuffer::UsagePattern value);
bool create();
bool isCreated() const;
void destroy();
bool bind();
void release();
static void release(QOpenGLBuffer::Type type);
GLuint bufferId() const;
int size() const /__len__/;
bool read(int offset, void *data, int count);
void write(int offset, const void *data, int count);
void allocate(const void *data, int count);
void allocate(int count);
void *map(QOpenGLBuffer::Access access);
bool unmap();
enum RangeAccessFlag /BaseType=Flag/
{
RangeRead,
RangeWrite,
RangeInvalidate,
RangeInvalidateBuffer,
RangeFlushExplicit,
RangeUnsynchronized,
};
typedef QFlags<QOpenGLBuffer::RangeAccessFlag> RangeAccessFlags;
void *mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access);
%If (Qt_6_5_0 -)
void swap(QOpenGLBuffer &other);
%End
};

View File

@@ -0,0 +1,163 @@
// qopengldebug.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLDebugMessage
{
%TypeHeaderCode
#include <qopengldebug.h>
%End
public:
enum Source /BaseType=Flag/
{
InvalidSource,
APISource,
WindowSystemSource,
ShaderCompilerSource,
ThirdPartySource,
ApplicationSource,
OtherSource,
AnySource,
};
typedef QFlags<QOpenGLDebugMessage::Source> Sources;
enum Type /BaseType=Flag/
{
InvalidType,
ErrorType,
DeprecatedBehaviorType,
UndefinedBehaviorType,
PortabilityType,
PerformanceType,
OtherType,
MarkerType,
GroupPushType,
GroupPopType,
AnyType,
};
typedef QFlags<QOpenGLDebugMessage::Type> Types;
enum Severity /BaseType=Flag/
{
InvalidSeverity,
HighSeverity,
MediumSeverity,
LowSeverity,
NotificationSeverity,
AnySeverity,
};
typedef QFlags<QOpenGLDebugMessage::Severity> Severities;
QOpenGLDebugMessage();
QOpenGLDebugMessage(const QOpenGLDebugMessage &debugMessage);
~QOpenGLDebugMessage();
void swap(QOpenGLDebugMessage &debugMessage /Constrained/);
QOpenGLDebugMessage::Source source() const;
QOpenGLDebugMessage::Type type() const;
QOpenGLDebugMessage::Severity severity() const;
GLuint id() const;
QString message() const;
static QOpenGLDebugMessage createApplicationMessage(const QString &text, GLuint id = 0, QOpenGLDebugMessage::Severity severity = QOpenGLDebugMessage::NotificationSeverity, QOpenGLDebugMessage::Type type = QOpenGLDebugMessage::OtherType);
static QOpenGLDebugMessage createThirdPartyMessage(const QString &text, GLuint id = 0, QOpenGLDebugMessage::Severity severity = QOpenGLDebugMessage::NotificationSeverity, QOpenGLDebugMessage::Type type = QOpenGLDebugMessage::OtherType);
bool operator==(const QOpenGLDebugMessage &debugMessage) const;
bool operator!=(const QOpenGLDebugMessage &debugMessage) const;
};
class QOpenGLDebugLogger : public QObject
{
%TypeHeaderCode
#include <qopengldebug.h>
%End
%ConvertToSubClassCode
static struct class_graph {
const char *name;
sipTypeDef **type;
int yes, no;
} graph[] = {
{sipName_QOpenGLDebugLogger, &sipType_QOpenGLDebugLogger, -1, 1},
{sipName_QOpenGLShader, &sipType_QOpenGLShader, -1, 2},
{sipName_QOpenGLShaderProgram, &sipType_QOpenGLShaderProgram, -1, 3},
#if !defined(SIP_FEATURE_PyQt_OpenGL_ES2)
{sipName_QOpenGLTimeMonitor, &sipType_QOpenGLTimeMonitor, -1, 4},
#else
{0, 0, -1, 4},
#endif
#if !defined(SIP_FEATURE_PyQt_OpenGL_ES2)
{sipName_QOpenGLTimerQuery, &sipType_QOpenGLTimerQuery, -1, 5},
#else
{0, 0, -1, 5},
#endif
{sipName_QOpenGLVertexArrayObject, &sipType_QOpenGLVertexArrayObject, -1, 6},
{sipName_QOpenGLWindow, &sipType_QOpenGLWindow, -1, -1},
};
int i = 0;
sipType = NULL;
do
{
struct class_graph *cg = &graph[i];
if (cg->name != NULL && sipCpp->inherits(cg->name))
{
sipType = *cg->type;
i = cg->yes;
}
else
i = cg->no;
}
while (i >= 0);
%End
public:
enum LoggingMode
{
AsynchronousLogging,
SynchronousLogging,
};
explicit QOpenGLDebugLogger(QObject *parent /TransferThis/ = 0);
virtual ~QOpenGLDebugLogger();
bool initialize();
bool isLogging() const;
QOpenGLDebugLogger::LoggingMode loggingMode() const;
qint64 maximumMessageLength() const;
void pushGroup(const QString &name, GLuint id = 0, QOpenGLDebugMessage::Source source = QOpenGLDebugMessage::ApplicationSource);
void popGroup();
void enableMessages(QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::Severities severities = QOpenGLDebugMessage::AnySeverity);
void enableMessages(const QList<unsigned int> &ids, QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType);
void disableMessages(QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::Severities severities = QOpenGLDebugMessage::AnySeverity);
void disableMessages(const QList<unsigned int> &ids, QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType);
QList<QOpenGLDebugMessage> loggedMessages() const;
public slots:
void logMessage(const QOpenGLDebugMessage &debugMessage);
void startLogging(QOpenGLDebugLogger::LoggingMode loggingMode = QOpenGLDebugLogger::AsynchronousLogging);
void stopLogging();
signals:
void messageLogged(const QOpenGLDebugMessage &debugMessage);
};

View File

@@ -0,0 +1,115 @@
// qopenglframebufferobject.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLFramebufferObject
{
%TypeHeaderCode
#include <qopenglframebufferobject.h>
%End
%TypeCode
// The defaults are different for desktop OpenGL and OpenGL/ES so pretend the
// latter is the former.
#if defined(QT_OPENGL_ES)
#undef GL_RGBA8
#define GL_RGBA8 GL_RGBA
#endif
%End
public:
enum Attachment
{
NoAttachment,
CombinedDepthStencil,
Depth,
};
QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D);
QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D);
QOpenGLFramebufferObject(const QSize &size, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8);
QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8);
QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format);
QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format);
virtual ~QOpenGLFramebufferObject();
QOpenGLFramebufferObjectFormat format() const;
bool isValid() const;
bool isBound() const;
bool bind();
bool release();
int width() const;
int height() const;
GLuint texture() const;
QList<unsigned int> textures() const;
QSize size() const;
QImage toImage(bool flipped = true) const;
QImage toImage(bool flipped, int colorAttachmentIndex) const;
QOpenGLFramebufferObject::Attachment attachment() const;
void setAttachment(QOpenGLFramebufferObject::Attachment attachment);
GLuint handle() const;
static bool bindDefault();
static bool hasOpenGLFramebufferObjects();
static bool hasOpenGLFramebufferBlit();
enum FramebufferRestorePolicy
{
DontRestoreFramebufferBinding,
RestoreFramebufferBindingToDefault,
RestoreFrameBufferBinding,
};
static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
static void blitFramebuffer(QOpenGLFramebufferObject *target, QOpenGLFramebufferObject *source, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex);
static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy);
GLuint takeTexture();
GLuint takeTexture(int colorAttachmentIndex);
void addColorAttachment(const QSize &size, GLenum internal_format = 0);
void addColorAttachment(int width, int height, GLenum internal_format = 0);
QList<QSize> sizes() const;
private:
QOpenGLFramebufferObject(const QOpenGLFramebufferObject &);
};
class QOpenGLFramebufferObjectFormat
{
%TypeHeaderCode
#include <qopenglframebufferobject.h>
%End
public:
QOpenGLFramebufferObjectFormat();
QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other);
~QOpenGLFramebufferObjectFormat();
void setSamples(int samples);
int samples() const;
void setMipmap(bool enabled);
bool mipmap() const;
void setAttachment(QOpenGLFramebufferObject::Attachment attachment);
QOpenGLFramebufferObject::Attachment attachment() const;
void setTextureTarget(GLenum target);
GLenum textureTarget() const;
void setInternalTextureFormat(GLenum internalTextureFormat);
GLenum internalTextureFormat() const;
bool operator==(const QOpenGLFramebufferObjectFormat &other) const;
bool operator!=(const QOpenGLFramebufferObjectFormat &other) const;
};

View File

@@ -0,0 +1,815 @@
// qopenglfunctions_es2.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_OpenGL_ES2)
class QOpenGLFunctions_ES2 : public QAbstractOpenGLFunctions
{
%TypeHeaderCode
#include <qopenglfunctions_es2.h>
%End
public:
QOpenGLFunctions_ES2();
bool initializeOpenGLFunctions();
void glActiveTexture(GLenum texture);
void glAttachShader(GLuint program, GLuint shader);
void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
void glBindBuffer(GLenum target, GLuint buffer);
void glBindFramebuffer(GLenum target, GLuint framebuffer);
void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
void glBindTexture(GLenum target, GLuint texture);
void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void glBlendEquation(GLenum mode);
void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
void glBlendFunc(GLenum sfactor, GLenum dfactor);
void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
void glBufferData(GLenum target, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/, GLenum usage);
%MethodCode
const GLvoid *array;
if (a2 == Py_None)
array = 0;
else
array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_BYTE, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glBufferData(a0, a1, array, a3);
%End
void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array;
if (a3 == Py_None)
array = 0;
else
array = qpyopengl_value_array(&sipError, a3, GL_UNSIGNED_BYTE, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glBufferSubData(a0, a1, a2, array);
%End
GLenum glCheckFramebufferStatus(GLenum target);
void glClear(GLbitfield mask);
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void glClearDepthf(GLclampf depth);
void glClearStencil(GLint s);
void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void glCompileShader(GLuint shader);
void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a7, GL_UNSIGNED_BYTE,
sipSelf);
if (sipError == sipErrorNone)
sipCpp->glCompressedTexImage2D(a0, a1, a2, a3, a4, a5, a6, array);
%End
void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE,
sipSelf);
if (sipError == sipErrorNone)
sipCpp->glCompressedTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array);
%End
void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GLuint glCreateProgram();
GLuint glCreateShader(GLenum type);
void glCullFace(GLenum mode);
void glDeleteBuffers(GLsizei n, SIP_PYOBJECT buffers /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
sipSelf);
if (sipError == sipErrorNone)
sipCpp->glDeleteBuffers(a0, reinterpret_cast<const GLuint *>(array));
%End
void glDeleteFramebuffers(GLsizei n, SIP_PYOBJECT framebuffers);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
sipSelf);
if (sipError == sipErrorNone)
sipCpp->glDeleteFramebuffers(a0, reinterpret_cast<const GLuint *>(array));
%End
void glDeleteProgram(GLuint program);
void glDeleteRenderbuffers(GLsizei n, SIP_PYOBJECT renderbuffers);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
sipSelf);
if (sipError == sipErrorNone)
sipCpp->glDeleteRenderbuffers(a0, reinterpret_cast<const GLuint *>(array));
%End
void glDeleteShader(GLuint shader);
void glDeleteTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT,
sipSelf);
if (sipError == sipErrorNone)
sipCpp->glDeleteTextures(a0, reinterpret_cast<const GLuint *>(array));
%End
void glDepthFunc(GLenum func);
void glDepthMask(GLboolean flag);
void glDepthRangef(GLclampf zNear, GLclampf zFar);
void glDetachShader(GLuint program, GLuint shader);
void glDisable(GLenum cap);
void glDisableVertexAttribArray(GLuint index);
void glDrawArrays(GLenum mode, GLint first, GLsizei count);
void glDrawElements(GLenum mode, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a3, a2, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glDrawElements(a0, a1, a2, array);
%End
void glEnable(GLenum cap);
void glEnableVertexAttribArray(GLuint index);
void glFinish();
void glFlush();
void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
void glFrontFace(GLenum mode);
void glGenBuffers(GLsizei n, SIP_PYOBJECT *buffers /TypeHint="Union[int, Tuple[int, ...]]"/);
%MethodCode
GLuint *params = new GLuint[a0];
sipCpp->glGenBuffers(a0, params);
a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
delete[] params;
%End
void glGenerateMipmap(GLenum target);
void glGenFramebuffers(GLsizei n, SIP_PYOBJECT framebuffers /TypeHint="Union[int, Tuple[int, ...]]"/);
%MethodCode
GLuint *params = new GLuint[a0];
sipCpp->glGenFramebuffers(a0, params);
a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
delete[] params;
%End
void glGenRenderbuffers(GLsizei n, SIP_PYOBJECT *renderbuffers /TypeHint="Union[int, Tuple[int, ...]]"/);
%MethodCode
GLuint *params = new GLuint[a0];
sipCpp->glGenRenderbuffers(a0, params);
a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
delete[] params;
%End
void glGenTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="Union[int, Tuple[int, ...]]"/);
%MethodCode
GLuint *params = new GLuint[a0];
sipCpp->glGenTextures(a0, params);
a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0);
delete[] params;
%End
SIP_PYOBJECT glGetActiveAttrib(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/;
%MethodCode
GLint bufsize;
sipCpp->glGetProgramiv(a0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &bufsize);
GLchar *name = new GLchar[bufsize];
GLint size;
GLenum type;
sipCpp->glGetActiveAttrib(a0, a1, bufsize, 0, &size, &type, name);
sipRes = Py_BuildValue("siI", name, size, type);
if (!sipRes)
sipIsErr = 1;
delete[] name;
%End
SIP_PYOBJECT glGetActiveUniform(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/;
%MethodCode
GLint bufsize;
sipCpp->glGetProgramiv(a0, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufsize);
GLchar *name = new GLchar[bufsize];
GLint size;
GLenum type;
sipCpp->glGetActiveUniform(a0, a1, bufsize, 0, &size, &type, name);
sipRes = Py_BuildValue("siI", name, size, type);
if (!sipRes)
sipIsErr = 1;
delete[] name;
%End
SIP_PYOBJECT glGetAttachedShaders(GLuint program) /TypeHint="Tuple[int, ...]"/;
%MethodCode
GLint nr_shaders;
sipCpp->glGetProgramiv(a0, GL_ATTACHED_SHADERS, &nr_shaders);
if (nr_shaders < 1)
{
sipRes = PyTuple_New(0);
}
else
{
GLuint *shaders = new GLuint[nr_shaders];
sipCpp->glGetAttachedShaders(a0, nr_shaders, 0, shaders);
sipRes = PyTuple_New(nr_shaders);
if (sipRes)
{
for (GLint i = 0; i < nr_shaders; ++i)
{
PyObject *itm = PyLong_FromLong(shaders[i]);
if (!itm)
{
Py_DECREF(sipRes);
sipRes = 0;
break;
}
PyTuple_SetItem(sipRes, i, itm);
}
}
delete[] shaders;
}
if (!sipRes)
sipIsErr = 1;
%End
int glGetAttribLocation(GLuint program, const GLchar *name);
void glGetBooleanv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[bool, Tuple[bool, ...]]"/);
%MethodCode
GLboolean fixed_params[16], *params;
GLint nr_params;
GLenum query;
nr_params = qpyopengl_get(a0, &query);
if (nr_params == 0)
{
sipCpp->glGetIntegerv(query, &nr_params);
params = new GLboolean[nr_params];
}
else
{
params = fixed_params;
}
sipCpp->glGetBooleanv(a0, params);
a1 = qpyopengl_from_GLboolean(&sipIsErr, params, nr_params);
if (params != fixed_params)
delete[] params;
%End
void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
GLenum glGetError();
void glGetFloatv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/);
%MethodCode
GLfloat fixed_params[16], *params;
GLint nr_params;
GLenum query;
nr_params = qpyopengl_get(a0, &query);
if (nr_params == 0)
{
sipCpp->glGetIntegerv(query, &nr_params);
params = new GLfloat[nr_params];
}
else
{
params = fixed_params;
}
sipCpp->glGetFloatv(a0, params);
a1 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params);
if (params != fixed_params)
delete[] params;
%End
void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
void glGetIntegerv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, ...]]"/);
%MethodCode
GLint fixed_params[16], *params;
GLint nr_params;
GLenum query;
nr_params = qpyopengl_get(a0, &query);
if (nr_params == 0)
{
sipCpp->glGetIntegerv(query, &nr_params);
params = new GLint[nr_params];
}
else
{
params = fixed_params;
}
sipCpp->glGetIntegerv(a0, params);
a1 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
if (params != fixed_params)
delete[] params;
%End
void glGetProgramiv(GLuint program, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int]]"/);
%MethodCode
GLint params[3];
Py_ssize_t nr_params;
switch (a1)
{
#if defined(GL_COMPUTE_LOCAL_WORK_SIZE)
case GL_COMPUTE_LOCAL_WORK_SIZE:
nr_params = 3;
break;
#endif
default:
nr_params = 1;
}
sipCpp->glGetProgramiv(a0, a1, params);
a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
%End
SIP_PYOBJECT glGetProgramInfoLog(GLuint program) /TypeHint="bytes"/;
%MethodCode
GLint bufsize;
sipCpp->glGetProgramiv(a0, GL_INFO_LOG_LENGTH, &bufsize);
if (bufsize > 0)
{
GLchar *log = new GLchar[bufsize];
sipCpp->glGetProgramInfoLog(a0, bufsize, 0, log);
sipRes = PyBytes_FromString(log);
delete[] log;
}
else
{
sipRes = PyBytes_FromString("");
}
%End
void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
SIP_PYOBJECT glGetShaderInfoLog(GLuint shader) /TypeHint="bytes"/;
%MethodCode
GLint bufsize;
sipCpp->glGetShaderiv(a0, GL_INFO_LOG_LENGTH, &bufsize);
if (bufsize > 0)
{
GLchar *log = new GLchar[bufsize];
sipCpp->glGetShaderInfoLog(a0, bufsize, 0, log);
sipRes = PyBytes_FromString(log);
delete[] log;
}
else
{
sipRes = PyBytes_FromString("");
}
%End
SIP_PYOBJECT glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype) /TypeHint="Tuple[Tuple[int, int], int]"/;
%MethodCode
GLint range[2], precision;
sipCpp->glGetShaderPrecisionFormat(a0, a1, range, &precision);
sipRes = Py_BuildValue("(ii)i", (int)range[0], (int)range[1], (int)precision);
if (!sipRes)
sipIsErr = 1;
%End
SIP_PYOBJECT glGetShaderSource(GLuint shader) /TypeHint="bytes"/;
%MethodCode
GLint bufsize;
sipCpp->glGetShaderiv(a0, GL_SHADER_SOURCE_LENGTH, &bufsize);
if (bufsize > 0)
{
GLchar *source = new GLchar[bufsize];
sipCpp->glGetShaderSource(a0, bufsize, 0, source);
sipRes = PyBytes_FromString(source);
delete[] source;
}
else
{
sipRes = PyBytes_FromString("");
}
%End
const char *glGetString(GLenum name);
%MethodCode
sipRes = reinterpret_cast<const char *>(sipCpp->glGetString(a0));
%End
void glGetTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/);
%MethodCode
GLfloat params[4];
Py_ssize_t nr_params;
switch (a1)
{
#if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR)
#if defined(GL_TEXTURE_SWIZZLE_RGBA)
case GL_TEXTURE_SWIZZLE_RGBA:
#endif
#if defined(GL_TEXTURE_BORDER_COLOR)
case GL_TEXTURE_BORDER_COLOR:
#endif
nr_params = 4;
break;
#endif
default:
nr_params = 1;
}
sipCpp->glGetTexParameterfv(a0, a1, params);
a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params);
%End
void glGetTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/);
%MethodCode
GLint params[4];
Py_ssize_t nr_params;
switch (a1)
{
#if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR)
#if defined(GL_TEXTURE_SWIZZLE_RGBA)
case GL_TEXTURE_SWIZZLE_RGBA:
#endif
#if defined(GL_TEXTURE_BORDER_COLOR)
case GL_TEXTURE_BORDER_COLOR:
#endif
nr_params = 4;
break;
#endif
default:
nr_params = 1;
}
sipCpp->glGetTexParameteriv(a0, a1, params);
a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
%End
int glGetUniformLocation(GLuint program, const GLchar *name);
void glGetVertexAttribfv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/);
%MethodCode
GLfloat params[4];
Py_ssize_t nr_params;
switch (a1)
{
case GL_CURRENT_VERTEX_ATTRIB:
nr_params = 4;
break;
default:
nr_params = 1;
}
sipCpp->glGetVertexAttribfv(a0, a1, params);
a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params);
%End
void glGetVertexAttribiv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/);
%MethodCode
GLint params[4];
Py_ssize_t nr_params;
switch (a1)
{
case GL_CURRENT_VERTEX_ATTRIB:
nr_params = 4;
break;
default:
nr_params = 1;
}
sipCpp->glGetVertexAttribiv(a0, a1, params);
a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params);
%End
void glHint(GLenum target, GLenum mode);
GLboolean glIsBuffer(GLuint buffer);
GLboolean glIsEnabled(GLenum cap);
GLboolean glIsFramebuffer(GLuint framebuffer);
GLboolean glIsProgram(GLuint program);
GLboolean glIsRenderbuffer(GLuint renderbuffer);
GLboolean glIsShader(GLuint shader);
GLboolean glIsTexture(GLuint texture);
void glLineWidth(GLfloat width);
void glLinkProgram(GLuint program);
void glPixelStorei(GLenum pname, GLint param);
void glPolygonOffset(GLfloat factor, GLfloat units);
SIP_PYOBJECT glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) /TypeHint="Union[Tuple[float, ...], Tuple[int, ...]]"/;
%MethodCode
int components;
switch (a4)
{
case GL_RGB:
{
components = 3;
break;
}
case GL_RGBA:
{
components = 4;
break;
}
case GL_ALPHA:
{
components = 1;
break;
}
default:
components = 0;
}
Py_ssize_t length = components * a2 * a3;
switch (a5)
{
// TODO: Implement array convertors for these formats.
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_BYTE:
default:
sipIsErr = 1;
PyErr_SetString(PyExc_ValueError, "pixel data format not supported");
}
%End
void glReleaseShaderCompiler();
void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
void glSampleCoverage(GLclampf value, GLboolean invert);
void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
void glStencilFunc(GLenum func, GLint ref, GLuint mask);
void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
void glStencilMask(GLuint mask);
void glStencilMaskSeparate(GLenum face, GLuint mask);
void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glTexImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array);
%End
void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
void glTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glTexParameterfv(a0, a1, reinterpret_cast<const GLfloat *>(array));
%End
void glTexParameteri(GLenum target, GLenum pname, GLint param);
void glTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glTexParameteriv(a0, a1, reinterpret_cast<const GLint *>(array));
%End
void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array);
%End
void glUniform1f(GLint location, GLfloat x);
void glUniform1fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform1fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
%End
void glUniform1i(GLint location, GLint x);
void glUniform1iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform1iv(a0, a1, reinterpret_cast<const GLint *>(array));
%End
void glUniform2f(GLint location, GLfloat x, GLfloat y);
void glUniform2fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform2fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
%End
void glUniform2i(GLint location, GLint x, GLint y);
void glUniform2iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform2iv(a0, a1, reinterpret_cast<const GLint *>(array));
%End
void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
void glUniform3fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform3fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
%End
void glUniform3i(GLint location, GLint x, GLint y, GLint z);
void glUniform3iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform3iv(a0, a1, reinterpret_cast<const GLint *>(array));
%End
void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void glUniform4fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform4fv(a0, a1, reinterpret_cast<const GLfloat *>(array));
%End
void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
void glUniform4iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniform4iv(a0, a1, reinterpret_cast<const GLint *>(array));
%End
void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniformMatrix2fv(a0, a1, a2,
reinterpret_cast<const GLfloat *>(array));
%End
void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniformMatrix3fv(a0, a1, a2,
reinterpret_cast<const GLfloat *>(array));
%End
void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glUniformMatrix4fv(a0, a1, a2,
reinterpret_cast<const GLfloat *>(array));
%End
void glUseProgram(GLuint program);
void glValidateProgram(GLuint program);
void glVertexAttrib1f(GLuint indx, GLfloat x);
void glVertexAttrib1fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glVertexAttrib1fv(a0, reinterpret_cast<const GLfloat *>(array));
%End
void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
void glVertexAttrib2fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glVertexAttrib2fv(a0, reinterpret_cast<const GLfloat *>(array));
%End
void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
void glVertexAttrib3fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glVertexAttrib3fv(a0, reinterpret_cast<const GLfloat *>(array));
%End
void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void glVertexAttrib4fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf);
if (sipError == sipErrorNone)
sipCpp->glVertexAttrib4fv(a0, reinterpret_cast<const GLfloat *>(array));
%End
void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, SIP_PYOBJECT ptr /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/);
%MethodCode
const GLvoid *array = qpyopengl_value_array_cached(&sipError, a5, a2, sipSelf,
"VertexAttribPointer", a0);
if (sipError == sipErrorNone)
sipCpp->glVertexAttribPointer(a0, a1, a2, a3, a4, array);
%End
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
};
%End

View File

@@ -0,0 +1,49 @@
// qopenglpaintdevice.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLPaintDevice : public QPaintDevice
{
%TypeHeaderCode
#include <qopenglpaintdevice.h>
%End
public:
QOpenGLPaintDevice();
explicit QOpenGLPaintDevice(const QSize &size);
QOpenGLPaintDevice(int width, int height);
virtual ~QOpenGLPaintDevice();
virtual QPaintEngine *paintEngine() const;
QOpenGLContext *context() const;
QSize size() const;
void setSize(const QSize &size);
qreal dotsPerMeterX() const;
qreal dotsPerMeterY() const;
void setDotsPerMeterX(qreal);
void setDotsPerMeterY(qreal);
void setPaintFlipped(bool flipped);
bool paintFlipped() const;
virtual void ensureActiveTarget();
void setDevicePixelRatio(qreal devicePixelRatio);
protected:
virtual int metric(QPaintDevice::PaintDeviceMetric metric) const;
};

View File

@@ -0,0 +1,50 @@
// qopenglpixeltransferoptions.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLPixelTransferOptions
{
%TypeHeaderCode
#include <qopenglpixeltransferoptions.h>
%End
public:
QOpenGLPixelTransferOptions();
QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &);
~QOpenGLPixelTransferOptions();
void swap(QOpenGLPixelTransferOptions &other /Constrained/);
void setAlignment(int alignment);
int alignment() const;
void setSkipImages(int skipImages);
int skipImages() const;
void setSkipRows(int skipRows);
int skipRows() const;
void setSkipPixels(int skipPixels);
int skipPixels() const;
void setImageHeight(int imageHeight);
int imageHeight() const;
void setRowLength(int rowLength);
int rowLength() const;
void setLeastSignificantByteFirst(bool lsbFirst);
bool isLeastSignificantBitFirst() const;
void setSwapBytesEnabled(bool swapBytes);
bool isSwapBytesEnabled() const;
};

View File

@@ -0,0 +1,319 @@
// qopenglshaderprogram.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLShader : public QObject
{
%TypeHeaderCode
#include <qopenglshaderprogram.h>
%End
public:
enum ShaderTypeBit /BaseType=Flag/
{
Vertex,
Fragment,
Geometry,
TessellationControl,
TessellationEvaluation,
Compute,
};
typedef QFlags<QOpenGLShader::ShaderTypeBit> ShaderType;
QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent /TransferThis/ = 0);
virtual ~QOpenGLShader();
QOpenGLShader::ShaderType shaderType() const;
bool compileSourceCode(const QByteArray &source);
bool compileSourceCode(const QString &source);
bool compileSourceFile(const QString &fileName);
QByteArray sourceCode() const;
bool isCompiled() const;
QString log() const;
GLuint shaderId() const;
static bool hasOpenGLShaders(QOpenGLShader::ShaderType type, QOpenGLContext *context = 0);
};
class QOpenGLShaderProgram : public QObject
{
%TypeHeaderCode
#include <qopenglshaderprogram.h>
%End
public:
explicit QOpenGLShaderProgram(QObject *parent /TransferThis/ = 0);
virtual ~QOpenGLShaderProgram();
bool addShader(QOpenGLShader *shader);
void removeShader(QOpenGLShader *shader);
QList<QOpenGLShader *> shaders() const;
bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray &source);
bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString &source);
bool addShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString &fileName);
void removeAllShaders();
virtual bool link();
bool isLinked() const;
QString log() const;
bool bind();
void release();
GLuint programId() const;
void bindAttributeLocation(const QByteArray &name, int location);
void bindAttributeLocation(const QString &name, int location);
int attributeLocation(const QByteArray &name) const;
int attributeLocation(const QString &name) const;
void setAttributeValue(int location, GLfloat value);
void setAttributeValue(int location, GLfloat x, GLfloat y);
void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z);
void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void setAttributeValue(int location, const QVector2D &value);
void setAttributeValue(int location, const QVector3D &value);
void setAttributeValue(int location, const QVector4D &value);
void setAttributeValue(int location, const QColor &value);
void setAttributeValue(const char *name, GLfloat value);
void setAttributeValue(const char *name, GLfloat x, GLfloat y);
void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z);
void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void setAttributeValue(const char *name, const QVector2D &value);
void setAttributeValue(const char *name, const QVector3D &value);
void setAttributeValue(const char *name, const QVector4D &value);
void setAttributeValue(const char *name, const QColor &value);
void setAttributeArray(int location, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_ATTRIBUTE_ARRAY"/);
%MethodCode
const GLfloat *values;
int tsize;
values = qpyopengl_attribute_array(a1, sipSelf, PyLong_FromLong(a0), &tsize,
&sipError);
if (values)
sipCpp->setAttributeArray(a0, values, tsize);
%End
void setAttributeArray(const char *name, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_ATTRIBUTE_ARRAY"/);
%MethodCode
const GLfloat *values;
int tsize;
values = qpyopengl_attribute_array(a1, sipSelf, PyBytes_FromString(a0),
&tsize, &sipError);
if (values)
sipCpp->setAttributeArray(a0, values, tsize);
%End
void setAttributeBuffer(int location, GLenum type, int offset, int tupleSize, int stride = 0);
void setAttributeBuffer(const char *name, GLenum type, int offset, int tupleSize, int stride = 0);
void enableAttributeArray(int location);
void enableAttributeArray(const char *name);
void disableAttributeArray(int location);
void disableAttributeArray(const char *name);
int uniformLocation(const QByteArray &name) const;
int uniformLocation(const QString &name) const;
void setUniformValue(int location, GLint value /Constrained/);
void setUniformValue(int location, GLfloat value /Constrained/);
void setUniformValue(int location, GLfloat x, GLfloat y);
void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z);
void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void setUniformValue(int location, const QVector2D &value);
void setUniformValue(int location, const QVector3D &value);
void setUniformValue(int location, const QVector4D &value);
void setUniformValue(int location, const QColor &color);
void setUniformValue(int location, const QPoint &point);
void setUniformValue(int location, const QPointF &point);
void setUniformValue(int location, const QSize &size);
void setUniformValue(int location, const QSizeF &size);
void setUniformValue(int location, const QMatrix2x2 &value);
void setUniformValue(int location, const QMatrix2x3 &value);
void setUniformValue(int location, const QMatrix2x4 &value);
void setUniformValue(int location, const QMatrix3x2 &value);
void setUniformValue(int location, const QMatrix3x3 &value);
void setUniformValue(int location, const QMatrix3x4 &value);
void setUniformValue(int location, const QMatrix4x2 &value);
void setUniformValue(int location, const QMatrix4x3 &value);
void setUniformValue(int location, const QMatrix4x4 &value);
void setUniformValue(int location, const QTransform &value);
void setUniformValue(const char *name, GLint value /Constrained/);
void setUniformValue(const char *name, GLfloat value /Constrained/);
void setUniformValue(const char *name, GLfloat x, GLfloat y);
void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z);
void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void setUniformValue(const char *name, const QVector2D &value);
void setUniformValue(const char *name, const QVector3D &value);
void setUniformValue(const char *name, const QVector4D &value);
void setUniformValue(const char *name, const QColor &color);
void setUniformValue(const char *name, const QPoint &point);
void setUniformValue(const char *name, const QPointF &point);
void setUniformValue(const char *name, const QSize &size);
void setUniformValue(const char *name, const QSizeF &size);
void setUniformValue(const char *name, const QMatrix2x2 &value);
void setUniformValue(const char *name, const QMatrix2x3 &value);
void setUniformValue(const char *name, const QMatrix2x4 &value);
void setUniformValue(const char *name, const QMatrix3x2 &value);
void setUniformValue(const char *name, const QMatrix3x3 &value);
void setUniformValue(const char *name, const QMatrix3x4 &value);
void setUniformValue(const char *name, const QMatrix4x2 &value);
void setUniformValue(const char *name, const QMatrix4x3 &value);
void setUniformValue(const char *name, const QMatrix4x4 &value);
void setUniformValue(const char *name, const QTransform &value);
void setUniformValueArray(int location, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_UNIFORM_VALUE_ARRAY"/);
%MethodCode
const void *values;
const sipTypeDef *array_type;
int array_len, tsize;
values = qpyopengl_uniform_value_array(a1, sipSelf, PyLong_FromLong(a0),
&array_type, &array_len, &tsize, &sipError);
if (values)
{
if (array_type == sipType_QVector2D)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QVector2D *>(values), array_len);
else if (array_type == sipType_QVector3D)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QVector3D *>(values), array_len);
else if (array_type == sipType_QVector4D)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QVector4D *>(values), array_len);
else if (array_type == sipType_QMatrix2x2)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix2x2 *>(values), array_len);
else if (array_type == sipType_QMatrix2x3)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix2x3 *>(values), array_len);
else if (array_type == sipType_QMatrix2x4)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix2x4 *>(values), array_len);
else if (array_type == sipType_QMatrix3x2)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix3x2 *>(values), array_len);
else if (array_type == sipType_QMatrix3x3)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix3x3 *>(values), array_len);
else if (array_type == sipType_QMatrix3x4)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix3x4 *>(values), array_len);
else if (array_type == sipType_QMatrix4x2)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix4x2 *>(values), array_len);
else if (array_type == sipType_QMatrix4x3)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix4x3 *>(values), array_len);
else if (array_type == sipType_QMatrix4x4)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix4x4 *>(values), array_len);
else
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const GLfloat *>(values), array_len, tsize);
}
%End
void setUniformValueArray(const char *name, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_UNIFORM_VALUE_ARRAY"/);
%MethodCode
const void *values;
const sipTypeDef *array_type;
int array_len, tsize;
values = qpyopengl_uniform_value_array(a1, sipSelf, PyBytes_FromString(a0),
&array_type, &array_len, &tsize, &sipError);
if (values)
{
if (array_type == sipType_QVector2D)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QVector2D *>(values), array_len);
else if (array_type == sipType_QVector3D)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QVector3D *>(values), array_len);
else if (array_type == sipType_QVector4D)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QVector4D *>(values), array_len);
else if (array_type == sipType_QMatrix2x2)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix2x2 *>(values), array_len);
else if (array_type == sipType_QMatrix2x3)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix2x3 *>(values), array_len);
else if (array_type == sipType_QMatrix2x4)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix2x4 *>(values), array_len);
else if (array_type == sipType_QMatrix3x2)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix3x2 *>(values), array_len);
else if (array_type == sipType_QMatrix3x3)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix3x3 *>(values), array_len);
else if (array_type == sipType_QMatrix3x4)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix3x4 *>(values), array_len);
else if (array_type == sipType_QMatrix4x2)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix4x2 *>(values), array_len);
else if (array_type == sipType_QMatrix4x3)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix4x3 *>(values), array_len);
else if (array_type == sipType_QMatrix4x4)
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const QMatrix4x4 *>(values), array_len);
else
sipCpp->setUniformValueArray(a0,
reinterpret_cast<const GLfloat *>(values), array_len, tsize);
}
%End
static bool hasOpenGLShaderPrograms(QOpenGLContext *context = 0);
int maxGeometryOutputVertices() const;
void setPatchVertexCount(int count);
int patchVertexCount() const;
void setDefaultOuterTessellationLevels(const QList<float> &levels);
QList<float> defaultOuterTessellationLevels() const;
void setDefaultInnerTessellationLevels(const QList<float> &levels);
QList<float> defaultInnerTessellationLevels() const;
bool create();
bool addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray &source);
bool addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString &source);
bool addCacheableShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString &fileName);
};
%ModuleHeaderCode
#include "qpyopengl_api.h"
%End
%InitialisationCode
qpyopengl_init();
%End
%TypeHintCode
# Convenient aliases for complicated OpenGL types.
PYQT_OPENGL_ARRAY = typing.Union[typing.Sequence[int], typing.Sequence[float],
PyQt6.sip.Buffer, None]
PYQT_OPENGL_BOUND_ARRAY = typing.Union[typing.Sequence[int],
typing.Sequence[float], PyQt6.sip.Buffer, int, None]
PYQT_SHADER_ATTRIBUTE_ARRAY = typing.Union[typing.Sequence[QtGui.QVector2D],
typing.Sequence[QtGui.QVector3D], typing.Sequence[QtGui.QVector4D],
typing.Sequence[typing.Sequence[float]]]
PYQT_SHADER_UNIFORM_VALUE_ARRAY = typing.Union[
typing.Sequence[QtGui.QVector2D], typing.Sequence[QtGui.QVector3D],
typing.Sequence[QtGui.QVector4D], typing.Sequence[QtGui.QMatrix2x2],
typing.Sequence[QtGui.QMatrix2x3], typing.Sequence[QtGui.QMatrix2x4],
typing.Sequence[QtGui.QMatrix3x2], typing.Sequence[QtGui.QMatrix3x3],
typing.Sequence[QtGui.QMatrix3x4], typing.Sequence[QtGui.QMatrix4x2],
typing.Sequence[QtGui.QMatrix4x3], typing.Sequence[QtGui.QMatrix4x4],
typing.Sequence[typing.Sequence[float]]]
%End

View File

@@ -0,0 +1,462 @@
// qopengltexture.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLTexture
{
%TypeHeaderCode
#include <qopengltexture.h>
%End
public:
enum Target
{
Target1D,
Target1DArray,
Target2D,
Target2DArray,
Target3D,
TargetCubeMap,
TargetCubeMapArray,
Target2DMultisample,
Target2DMultisampleArray,
TargetRectangle,
TargetBuffer,
};
enum BindingTarget
{
BindingTarget1D,
BindingTarget1DArray,
BindingTarget2D,
BindingTarget2DArray,
BindingTarget3D,
BindingTargetCubeMap,
BindingTargetCubeMapArray,
BindingTarget2DMultisample,
BindingTarget2DMultisampleArray,
BindingTargetRectangle,
BindingTargetBuffer,
};
enum MipMapGeneration
{
GenerateMipMaps,
DontGenerateMipMaps,
};
enum TextureUnitReset
{
ResetTextureUnit,
DontResetTextureUnit,
};
explicit QOpenGLTexture(QOpenGLTexture::Target target);
QOpenGLTexture(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps);
~QOpenGLTexture();
bool create();
void destroy();
bool isCreated() const;
GLuint textureId() const;
void bind();
void bind(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
void release();
void release(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
bool isBound() const;
bool isBound(uint unit);
static GLuint boundTextureId(QOpenGLTexture::BindingTarget target);
static GLuint boundTextureId(uint unit, QOpenGLTexture::BindingTarget target);
enum TextureFormat
{
NoFormat,
R8_UNorm,
RG8_UNorm,
RGB8_UNorm,
RGBA8_UNorm,
R16_UNorm,
RG16_UNorm,
RGB16_UNorm,
RGBA16_UNorm,
R8_SNorm,
RG8_SNorm,
RGB8_SNorm,
RGBA8_SNorm,
R16_SNorm,
RG16_SNorm,
RGB16_SNorm,
RGBA16_SNorm,
R8U,
RG8U,
RGB8U,
RGBA8U,
R16U,
RG16U,
RGB16U,
RGBA16U,
R32U,
RG32U,
RGB32U,
RGBA32U,
R8I,
RG8I,
RGB8I,
RGBA8I,
R16I,
RG16I,
RGB16I,
RGBA16I,
R32I,
RG32I,
RGB32I,
RGBA32I,
R16F,
RG16F,
RGB16F,
RGBA16F,
R32F,
RG32F,
RGB32F,
RGBA32F,
RGB9E5,
RG11B10F,
RG3B2,
R5G6B5,
RGB5A1,
RGBA4,
RGB10A2,
D16,
D24,
D24S8,
D32,
D32F,
D32FS8X24,
RGB_DXT1,
RGBA_DXT1,
RGBA_DXT3,
RGBA_DXT5,
R_ATI1N_UNorm,
R_ATI1N_SNorm,
RG_ATI2N_UNorm,
RG_ATI2N_SNorm,
RGB_BP_UNSIGNED_FLOAT,
RGB_BP_SIGNED_FLOAT,
RGB_BP_UNorm,
SRGB8,
SRGB8_Alpha8,
SRGB_DXT1,
SRGB_Alpha_DXT1,
SRGB_Alpha_DXT3,
SRGB_Alpha_DXT5,
SRGB_BP_UNorm,
DepthFormat,
AlphaFormat,
RGBFormat,
RGBAFormat,
LuminanceFormat,
LuminanceAlphaFormat,
S8,
R11_EAC_UNorm,
R11_EAC_SNorm,
RG11_EAC_UNorm,
RG11_EAC_SNorm,
RGB8_ETC2,
SRGB8_ETC2,
RGB8_PunchThrough_Alpha1_ETC2,
SRGB8_PunchThrough_Alpha1_ETC2,
RGBA8_ETC2_EAC,
SRGB8_Alpha8_ETC2_EAC,
RGB8_ETC1,
RGBA_ASTC_4x4,
RGBA_ASTC_5x4,
RGBA_ASTC_5x5,
RGBA_ASTC_6x5,
RGBA_ASTC_6x6,
RGBA_ASTC_8x5,
RGBA_ASTC_8x6,
RGBA_ASTC_8x8,
RGBA_ASTC_10x5,
RGBA_ASTC_10x6,
RGBA_ASTC_10x8,
RGBA_ASTC_10x10,
RGBA_ASTC_12x10,
RGBA_ASTC_12x12,
SRGB8_Alpha8_ASTC_4x4,
SRGB8_Alpha8_ASTC_5x4,
SRGB8_Alpha8_ASTC_5x5,
SRGB8_Alpha8_ASTC_6x5,
SRGB8_Alpha8_ASTC_6x6,
SRGB8_Alpha8_ASTC_8x5,
SRGB8_Alpha8_ASTC_8x6,
SRGB8_Alpha8_ASTC_8x8,
SRGB8_Alpha8_ASTC_10x5,
SRGB8_Alpha8_ASTC_10x6,
SRGB8_Alpha8_ASTC_10x8,
SRGB8_Alpha8_ASTC_10x10,
SRGB8_Alpha8_ASTC_12x10,
SRGB8_Alpha8_ASTC_12x12,
};
void setFormat(QOpenGLTexture::TextureFormat format);
QOpenGLTexture::TextureFormat format() const;
void setSize(int width, int height = 1, int depth = 1);
int width() const;
int height() const;
int depth() const;
void setMipLevels(int levels);
int mipLevels() const;
int maximumMipLevels() const;
void setLayers(int layers);
int layers() const;
int faces() const;
void allocateStorage();
void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType);
bool isStorageAllocated() const;
QOpenGLTexture *createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const /Factory/;
bool isTextureView() const;
enum CubeMapFace
{
CubeMapPositiveX,
CubeMapNegativeX,
CubeMapPositiveY,
CubeMapNegativeY,
CubeMapPositiveZ,
CubeMapNegativeZ,
};
enum PixelFormat
{
NoSourceFormat,
Red,
RG,
RGB,
BGR,
RGBA,
BGRA,
Red_Integer,
RG_Integer,
RGB_Integer,
BGR_Integer,
RGBA_Integer,
BGRA_Integer,
Depth,
DepthStencil,
Alpha,
Luminance,
LuminanceAlpha,
Stencil,
};
enum PixelType
{
NoPixelType,
Int8,
UInt8,
Int16,
UInt16,
Int32,
UInt32,
Float16,
Float16OES,
Float32,
UInt32_RGB9_E5,
UInt32_RG11B10F,
UInt8_RG3B2,
UInt8_RG3B2_Rev,
UInt16_RGB5A1,
UInt16_RGB5A1_Rev,
UInt16_R5G6B5,
UInt16_R5G6B5_Rev,
UInt16_RGBA4,
UInt16_RGBA4_Rev,
UInt32_RGB10A2,
UInt32_RGB10A2_Rev,
UInt32_RGBA8,
UInt32_RGBA8_Rev,
UInt32_D24S8,
Float32_D32_UInt32_S8_X24,
};
void setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
void setData(int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
void setData(int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
void setData(QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
void setData(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps);
void setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
void setCompressedData(int mipLevel, int layer, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
void setCompressedData(int mipLevel, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
void setCompressedData(int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
enum Feature /BaseType=Flag/
{
ImmutableStorage,
ImmutableMultisampleStorage,
TextureRectangle,
TextureArrays,
Texture3D,
TextureMultisample,
TextureBuffer,
TextureCubeMapArrays,
Swizzle,
StencilTexturing,
AnisotropicFiltering,
NPOTTextures,
NPOTTextureRepeat,
Texture1D,
TextureComparisonOperators,
TextureMipMapLevel,
};
typedef QFlags<QOpenGLTexture::Feature> Features;
static bool hasFeature(QOpenGLTexture::Feature feature);
void setMipBaseLevel(int baseLevel);
int mipBaseLevel() const;
void setMipMaxLevel(int maxLevel);
int mipMaxLevel() const;
void setMipLevelRange(int baseLevel, int maxLevel);
std::pair<int, int> mipLevelRange() const;
void setAutoMipMapGenerationEnabled(bool enabled);
bool isAutoMipMapGenerationEnabled() const;
void generateMipMaps();
void generateMipMaps(int baseLevel, bool resetBaseLevel = true);
enum SwizzleComponent
{
SwizzleRed,
SwizzleGreen,
SwizzleBlue,
SwizzleAlpha,
};
enum SwizzleValue
{
RedValue,
GreenValue,
BlueValue,
AlphaValue,
ZeroValue,
OneValue,
};
void setSwizzleMask(QOpenGLTexture::SwizzleComponent component, QOpenGLTexture::SwizzleValue value);
void setSwizzleMask(QOpenGLTexture::SwizzleValue r, QOpenGLTexture::SwizzleValue g, QOpenGLTexture::SwizzleValue b, QOpenGLTexture::SwizzleValue a);
QOpenGLTexture::SwizzleValue swizzleMask(QOpenGLTexture::SwizzleComponent component) const;
enum DepthStencilMode
{
DepthMode,
StencilMode,
};
void setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode);
QOpenGLTexture::DepthStencilMode depthStencilMode() const;
enum Filter
{
Nearest,
Linear,
NearestMipMapNearest,
NearestMipMapLinear,
LinearMipMapNearest,
LinearMipMapLinear,
};
void setMinificationFilter(QOpenGLTexture::Filter filter);
QOpenGLTexture::Filter minificationFilter() const;
void setMagnificationFilter(QOpenGLTexture::Filter filter);
QOpenGLTexture::Filter magnificationFilter() const;
void setMinMagFilters(QOpenGLTexture::Filter minificationFilter, QOpenGLTexture::Filter magnificationFilter);
std::pair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> minMagFilters() const;
void setMaximumAnisotropy(float anisotropy);
float maximumAnisotropy() const;
enum WrapMode
{
Repeat,
MirroredRepeat,
ClampToEdge,
ClampToBorder,
};
enum CoordinateDirection
{
DirectionS,
DirectionT,
DirectionR,
};
void setWrapMode(QOpenGLTexture::WrapMode mode);
void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode);
QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const;
void setBorderColor(const QColor &color);
QColor borderColor() const;
void setMinimumLevelOfDetail(float value);
float minimumLevelOfDetail() const;
void setMaximumLevelOfDetail(float value);
float maximumLevelOfDetail() const;
void setLevelOfDetailRange(float min, float max);
std::pair<float, float> levelOfDetailRange() const;
void setLevelofDetailBias(float bias);
float levelofDetailBias() const;
QOpenGLTexture::Target target() const;
void setSamples(int samples);
int samples() const;
void setFixedSamplePositions(bool fixed);
bool isFixedSamplePositions() const;
enum ComparisonFunction
{
CompareLessEqual,
CompareGreaterEqual,
CompareLess,
CompareGreater,
CompareEqual,
CommpareNotEqual,
CompareAlways,
CompareNever,
%If (Qt_6_1_0 -)
CompareNotEqual,
%End
};
void setComparisonFunction(QOpenGLTexture::ComparisonFunction function);
QOpenGLTexture::ComparisonFunction comparisonFunction() const;
enum ComparisonMode
{
CompareRefToTexture,
CompareNone,
};
void setComparisonMode(QOpenGLTexture::ComparisonMode mode);
QOpenGLTexture::ComparisonMode comparisonMode() const;
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);
void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0);
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);
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);
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);
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);
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);
private:
QOpenGLTexture(const QOpenGLTexture &);
};

View File

@@ -0,0 +1,57 @@
// qopengltextureblitter.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLTextureBlitter
{
%TypeHeaderCode
#include <qopengltextureblitter.h>
%End
public:
QOpenGLTextureBlitter();
~QOpenGLTextureBlitter();
enum Origin
{
OriginBottomLeft,
OriginTopLeft,
};
bool create();
bool isCreated() const;
void destroy();
bool supportsExternalOESTarget() const;
void bind(GLenum target = GL_TEXTURE_2D);
void release();
void setRedBlueSwizzle(bool swizzle);
void setOpacity(float opacity);
void blit(GLuint texture, const QMatrix4x4 &targetTransform, QOpenGLTextureBlitter::Origin sourceOrigin);
void blit(GLuint texture, const QMatrix4x4 &targetTransform, const QMatrix3x3 &sourceTransform);
static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport);
static QMatrix3x3 sourceTransform(const QRectF &subTexture, const QSize &textureSize, QOpenGLTextureBlitter::Origin origin);
%If (Qt_6_3_0 -)
bool supportsRectangleTarget() const;
%End
private:
QOpenGLTextureBlitter(const QOpenGLTextureBlitter &);
};

View File

@@ -0,0 +1,71 @@
// qopengltimerquery.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (!PyQt_OpenGL_ES2)
class QOpenGLTimerQuery : public QObject
{
%TypeHeaderCode
#include <qopengltimerquery.h>
%End
public:
explicit QOpenGLTimerQuery(QObject *parent /TransferThis/ = 0);
virtual ~QOpenGLTimerQuery();
bool create();
void destroy();
bool isCreated() const;
GLuint objectId() const;
void begin();
void end();
GLuint64 waitForTimestamp() const /ReleaseGIL/;
void recordTimestamp();
bool isResultAvailable() const;
GLuint64 waitForResult() const /ReleaseGIL/;
};
%End
%If (!PyQt_OpenGL_ES2)
class QOpenGLTimeMonitor : public QObject
{
%TypeHeaderCode
#include <qopengltimerquery.h>
%End
public:
explicit QOpenGLTimeMonitor(QObject *parent /TransferThis/ = 0);
virtual ~QOpenGLTimeMonitor();
void setSampleCount(int sampleCount);
int sampleCount() const;
bool create();
void destroy();
bool isCreated() const;
QList<unsigned int> objectIds() const;
int recordSample();
bool isResultAvailable() const;
QList<GLuint64> waitForSamples() const /ReleaseGIL/;
QList<GLuint64> waitForIntervals() const /ReleaseGIL/;
void reset();
};
%End

View File

@@ -0,0 +1,30 @@
// qopenglversionfunctions.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QAbstractOpenGLFunctions /NoDefaultCtors,Supertype=PyQt6.sip.wrapper/
{
%TypeHeaderCode
#include <qopenglversionfunctions.h>
%End
QAbstractOpenGLFunctions(const QAbstractOpenGLFunctions &);
};

View File

@@ -0,0 +1,34 @@
// qopenglversionfunctionsfactory.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLVersionFunctionsFactory
{
%TypeHeaderCode
#include <qopenglversionfunctionsfactory.h>
%End
public:
static SIP_PYOBJECT get(const QOpenGLVersionProfile &versionProfile = QOpenGLVersionProfile(), QOpenGLContext *context /GetWrapper/ = 0) /TypeHint="QAbstractOpenGLFunctions"/;
%MethodCode
sipRes = qpyopengl_version_functions(*a0, a1, a1Wrapper);
%End
};

View File

@@ -0,0 +1,48 @@
// qopenglversionprofile.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLVersionProfile
{
%TypeHeaderCode
#include <qopenglversionprofile.h>
%End
public:
QOpenGLVersionProfile();
explicit QOpenGLVersionProfile(const QSurfaceFormat &format);
QOpenGLVersionProfile(const QOpenGLVersionProfile &other);
~QOpenGLVersionProfile();
std::pair<int, int> version() const;
void setVersion(int majorVersion, int minorVersion);
QSurfaceFormat::OpenGLContextProfile profile() const;
void setProfile(QSurfaceFormat::OpenGLContextProfile profile);
bool hasProfiles() const;
bool isLegacyVersion() const;
bool isValid() const;
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
};
bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs);
bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs);

View File

@@ -0,0 +1,65 @@
// qopenglvertexarrayobject.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLVertexArrayObject : public QObject
{
%TypeHeaderCode
#include <qopenglvertexarrayobject.h>
%End
public:
explicit QOpenGLVertexArrayObject(QObject *parent /TransferThis/ = 0);
virtual ~QOpenGLVertexArrayObject();
bool create();
void destroy();
bool isCreated() const;
GLuint objectId() const;
void bind();
void release();
class Binder
{
%TypeHeaderCode
#include <qopenglvertexarrayobject.h>
%End
public:
Binder(QOpenGLVertexArrayObject *v);
~Binder();
void release();
void rebind();
SIP_PYOBJECT __enter__();
%MethodCode
// Just return a reference to self.
sipRes = sipSelf;
Py_INCREF(sipRes);
%End
void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
%MethodCode
sipCpp->release();
%End
private:
Binder(const QOpenGLVertexArrayObject::Binder &);
};
};

View File

@@ -0,0 +1,61 @@
// qopenglwindow.sip generated by MetaSIP
//
// This file is part of the QtOpenGL Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QOpenGLWindow : public QPaintDeviceWindow
{
%TypeHeaderCode
#include <qopenglwindow.h>
%End
public:
enum UpdateBehavior
{
NoPartialUpdate,
PartialUpdateBlit,
PartialUpdateBlend,
};
QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior = QOpenGLWindow::NoPartialUpdate, QWindow *parent /TransferThis/ = 0);
QOpenGLWindow(QOpenGLContext *shareContext, QOpenGLWindow::UpdateBehavior updateBehavior = QOpenGLWindow::NoPartialUpdate, QWindow *parent /TransferThis/ = 0);
virtual ~QOpenGLWindow();
QOpenGLWindow::UpdateBehavior updateBehavior() const;
bool isValid() const;
void makeCurrent();
void doneCurrent();
QOpenGLContext *context() const;
GLuint defaultFramebufferObject() const;
QImage grabFramebuffer();
QOpenGLContext *shareContext() const;
signals:
void frameSwapped();
protected:
virtual void initializeGL();
virtual void resizeGL(int w, int h);
virtual void paintGL();
virtual void paintUnderGL();
virtual void paintOverGL();
virtual void paintEvent(QPaintEvent *event);
virtual void resizeEvent(QResizeEvent *event);
virtual int metric(QPaintDevice::PaintDeviceMetric metric) const;
};

View File

@@ -0,0 +1,129 @@
// This is the SIP interface definition for the QList based mapped types
// specific to the QtOpenGL module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (!PyQt_OpenGL_ES2)
%MappedType QList<GLuint64>
/TypeHintIn="Iterable[int]", TypeHintOut="List[int]",
TypeHintValue="[]"/
{
%TypeHeaderCode
#include <qlist.h>
#include <qopengl.h>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New(sipCpp->size());
if (!l)
return 0;
for (int i = 0; i < sipCpp->size(); ++i)
{
// Convert to a Python long to make sure it doesn't get interpreted as
// a signed value.
PyObject *pobj = PyLong_FromUnsignedLongLong(sipCpp->value(i));
if (!pobj)
{
Py_DECREF(l);
return 0;
}
PyList_SetItem(l, i, pobj);
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QList<GLuint64> *qv = new QList<GLuint64>;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete qv;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
PyErr_Clear();
unsigned long long val = PyLong_AsUnsignedLongLongMask(itm);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but 'int' is expected", i,
sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete qv;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
qv->append(val);
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = qv;
return sipGetState(sipTransferObj);
%End
};
%End

View File

@@ -0,0 +1,111 @@
// This is the SIP interface definition for the std::pair based mapped types
// specific to the QtGui module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%MappedType std::pair<QOpenGLTexture::Filter, QOpenGLTexture::Filter>
/TypeHint="Tuple[QOpenGLTexture.Filter, QOpenGLTexture.Filter]"/
{
%TypeHeaderCode
#include <QOpenGLTexture>
%End
%ConvertFromTypeCode
return sipBuildResult(NULL, "(FF)", sipCpp->first,
sipType_QOpenGLTexture_Filter, sipCpp->second,
sipType_QOpenGLTexture_Filter);
%End
%ConvertToTypeCode
if (!sipIsErr)
return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy));
Py_ssize_t len = PySequence_Size(sipPy);
if (len != 2)
{
// A negative length should only be an internal error so let the
// original exception stand.
if (len >= 0)
PyErr_Format(PyExc_TypeError,
"sequence has %zd elements but 2 elements are expected",
len);
*sipIsErr = 1;
return 0;
}
PyObject *firstobj = PySequence_GetItem(sipPy, 0);
if (!firstobj)
{
*sipIsErr = 1;
return 0;
}
int firstv = sipConvertToEnum(firstobj, sipType_QOpenGLTexture_Filter);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"the first element has type '%s' but 'QOpenGLTexture.Filter' is expected",
sipPyTypeName(Py_TYPE(firstobj)));
*sipIsErr = 1;
return 0;
}
PyObject *secondobj = PySequence_GetItem(sipPy, 1);
if (!secondobj)
{
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
int secondv = sipConvertToEnum(secondobj, sipType_QOpenGLTexture_Filter);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"the second element has type '%s' but 'QOpenGLTexture.Filter' is expected",
sipPyTypeName(Py_TYPE(secondobj)));
Py_DECREF(secondobj);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new std::pair<QOpenGLTexture::Filter, QOpenGLTexture::Filter>(
static_cast<QOpenGLTexture::Filter>(firstv),
static_cast<QOpenGLTexture::Filter>(secondv));
Py_DECREF(secondobj);
Py_DECREF(firstobj);
return sipGetState(sipTransferObj);
%End
};