diff options
Diffstat (limited to 'sources/pyside6/PySide6')
| -rw-r--r-- | sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml | 24 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 54 |
2 files changed, 78 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml index c55afe590..29c5b11e5 100644 --- a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml +++ b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml @@ -2652,6 +2652,13 @@ <object-type name="QOpenGLPaintDevice" since="5.0"/> --> <object-type name="QOpenGLExtraFunctions" since="5.6"> + <extra-includes> + <include file-name="QtCore/QVarLengthArray" location="global"/> + <include file-name="sbkcpptonumpy.h" location="global"/> + </extra-includes> + <inject-code class="native" position="beginning" file="../glue/qtgui.cpp" + snippet="qopenglextrafunctions-glgeti-v-return-size"/> + <!-- Exlusions due to compile errors --> <modify-function signature="glEndTransformFeedback()" remove="all"/> <modify-function signature="glPauseTransformFeedback()" remove="all"/> @@ -2705,9 +2712,26 @@ <modify-function signature="glGetFramebufferParameteriv(&GLuint;,&GLuint;,&GLint;*)"> <modify-argument index="3"><array/></modify-argument> </modify-function> + <modify-function signature="glGetBooleani_v(&GLuint;,&GLuint;,&GLboolean;*)"> + <modify-argument index="return" pyi-type="Union[bool,numpy.ndarray]"> + <replace-type modified-type="PyObject"/> + </modify-argument> + <modify-argument index="3"> + <remove-argument/> + </modify-argument> + <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" + snippet="qopenglextrafunctions-glgetbooleani-v"/> + </modify-function> + <!-- FIXME PYSIDE 7: Use the remove array modification and use + the version with return value instead --> <modify-function signature="glGetIntegeri_v(&GLuint;,&GLuint;,&GLint;*)"> <modify-argument index="3"><array/></modify-argument> </modify-function> + <add-function signature="glGetIntegeri_v(&GLuint;,&GLuint;)" return-type="PyObject"> + <modify-argument index="return" pyi-type="Union[int,numpy.ndarray]"/> + <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" + snippet="qopenglextrafunctions-glgetintegeri-v"/> + </add-function> <modify-function signature="glGetInternalformativ(&GLuint;,&GLuint;,&GLuint;,&GLint;,&GLint;*)"> <modify-argument index="5"><array/></modify-argument> </modify-function> diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp index 0b6fa7459..22c5d70fc 100644 --- a/sources/pyside6/PySide6/glue/qtgui.cpp +++ b/sources/pyside6/PySide6/glue/qtgui.cpp @@ -134,6 +134,16 @@ static int glGetVReturnSize(GLenum pname) } // @snippet qopenglfunctions-glgetv-return-size +// @snippet qopenglextrafunctions-glgeti-v-return-size +// Return the number of return values of the indexed +// glGetBoolean/Double/Integeri_v functions +// cf https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGet.xhtml +static int glGetI_VReturnSize(GLenum pname) +{ + return pname == GL_VIEWPORT ? 4 : 1; +} +// @snippet qopenglextrafunctions-glgeti-v-return-size + // @snippet qopenglfunctions-glgetbooleanv const int size = glGetVReturnSize(%1); QVarLengthArray<GLboolean> result(size, GL_FALSE); @@ -178,6 +188,50 @@ if (size == 1) { } // @snippet qopenglfunctions-glgetintegerv +// @snippet qopenglextrafunctions-glgetbooleani-v +const int size = glGetI_VReturnSize(%1); +QVarLengthArray<GLboolean> result(size, GL_FALSE); +%CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, result.data()); +if (size == 1) { + %PYARG_0 = %CONVERTTOPYTHON[bool](result[0]); +} else { + %PYARG_0 = Shiboken::Numpy::createByteArray1(size, result.constData()); +} +// @snippet qopenglextrafunctions-glgetbooleani-v + +// @snippet qopenglextrafunctions-glgetdoublei-v +const int size = glGetI_VReturnSize(%1); +QVarLengthArray<GLdouble> result(size, 0); +%CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, result.data()); +if (size == 1) { + %PYARG_0 = %CONVERTTOPYTHON[double](result[0]); +} else { + %PYARG_0 = Shiboken::Numpy::createDoubleArray1(size, result.constData()); +} +// @snippet qopenglextrafunctions-glgetdoublei-v + +// @snippet qopenglextrafunctions-glgetfloati-v +const int size = glGetI_VReturnSize(%1); +QVarLengthArray<GLfloat> result(size, 0); +%CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, result.data()); +if (size == 1) { + %PYARG_0 = %CONVERTTOPYTHON[float](result[0]); +} else { + %PYARG_0 = Shiboken::Numpy::createFloatArray1(size, result.constData()); +} +// @snippet qopenglextrafunctions-glgetfloati-v + +// @snippet qopenglextrafunctions-glgetintegeri-v +const int size = glGetI_VReturnSize(%1); +QVarLengthArray<GLint> result(size, 0); +%CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, result.data()); +if (size == 1) { + %PYARG_0 = %CONVERTTOPYTHON[int](result[0]); +} else { + %PYARG_0 = Shiboken::Numpy::createIntArray1(size, result.constData()); +} +// @snippet qopenglextrafunctions-glgetintegeri-v + // @snippet glgetshadersource GLsizei bufSize = 4096; GLsizei length = bufSize - 1; |
