diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-08-05 11:11:52 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-08-09 13:02:33 +0200 |
| commit | 34585b87fa5a06d3f9928d82d95ee242bdc54fb6 (patch) | |
| tree | 16ef2042dba4695ed7e552cda6d998ac0f229cb0 /sources/pyside6/PySide6/glue/qtgui.cpp | |
| parent | c140a3cef8a9fe416209e221724f55afe332ee04 (diff) | |
Add glGet(Boolean|Integer)i_v() to QtGui's QOpenGLExtraFunctions
These functions are similar to the glGet(Boolean|Integer)v()
versions, but take an additional index parameter and
may return arrays of different sizes.
Task-number: PYSIDE-2013
Task-number: PYSIDE-2017
Change-Id: I900ce989416ed00e7662769347e9469be313d82c
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtgui.cpp')
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
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; |
