[PyQt] Expose QOpenGLContext::getProcAddress?

Georg Brandl g.brandl at fz-juelich.de
Sat Apr 13 04:33:54 BST 2019


On 12.04.19 22:55, Phil Thompson wrote:
> On 12 Apr 2019, at 10:49 pm, Georg Brandl <g.brandl at fz-juelich.de>
> wrote:
>>
>> Hi,
>>
>> for integrating a PyQt application with OpenGL drawing in an
>> extension module written in another language, it would be useful to
>> have this method exposed in the QOpenGLContext class.
>>
>> It is already exposed in the legacy QGLContext class, and I can use
>> that for now, but from the docs it sounds like the QGL classes
>> should not be used anymore.
>
> Just because it is exposed doesn't mean it is useful. As I understand
> it it returns the address of a C function wrapped as a sip.voidptr.
> Is that useful?
Yes, that's what it does.  It seems that the OpenGL library is usually
loaded at runtime by some helper library, and individual functions are
resolved with dlsym.  That way, applications can react to various
functions and extensions being available or not.

Qt has it in the QOpenGLContext class, and for example, PyOpenGL
does it via ctypes.  Other GL helper libraries like GLFW have them
as well:
https://www.glfw.org/docs/latest/group__context.html#ga35f1837e6f666781842483937612f163

My drawing code, being written in Rust, also depends on a function
that resolves the functions at runtime.  Since I'd like to make sure
that the functions are resolved in the same way that Qt already does
for the calls it makes internally for the widget, I'd like to pass
QOpenGLContext::getProcAddress to it, via a Python callback function.

Thanks,
Georg


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------



More information about the PyQt mailing list