[PyQt] Implementation of the QQuickFramebufferObject

Rostyslav Lyulinetskyy info at rostik.de
Thu Sep 24 09:58:33 BST 2015


On 22.09.2015 18:06, Phil Thompson wrote:
> On 21 Sep 2015, at 11:44 am, Rostyslav Lyulinetskyy <info at rostik.de> wrote:
>> On 18.09.2015 19:03, Phil Thompson wrote:
>>> On 15 Sep 2015, at 12:14 pm, Rostyslav Lyulinetskyy <info at rostik.de> wrote:
>>>> Hi,
>>>>
>>>> I am trying to port my c++ code to python and I am integrating a custom OpenGL rendering with Qt Quick via QQuickFramebufferObject (as described here: https://blog.qt.io/blog/2015/05/11/integrating-custom-opengl-rendering-with-qt-quick-via-qquickframebufferobject/)
>>>> Everything works well in c++, but for various reasons I need to port this to python and it doesn't seem to work. The virtual function createRenderer() in the QQuickFramebufferObject must be overridden so one can return a new renderer, but for some reason this function is not even called when using PyQt.
>>>>
>>>> Is it even possible to override this virtual function from python? Am I missing something?
>>>>
>>>> Here is a small example to replicate that the createRenderer() function is not called:
>>>> https://gist.github.com/rostikL/7876e4c47fc8dd8ce02f
>>> Tonight's snapshot will make sure createRenderer() is called. However there may well be issues with the ownership of the returned renderer. Please test and let me know.
>>>
>>> Phil
>> Hi,
>>
>> Thanks for the implementation. I have tested it and createRenderer() function is being called now. I have now extended the example (https://gist.github.com/rostikL/7876e4c47fc8dd8ce02f) to get a new Renderer object which inherits from the QQuickFramebufferObject.Renderer class and the application crashes with "Segmentation fault" as error message.
>>
>> The same thing happens in c++ when the following 3 functions are not implemented in the new Renderer:
>> - createFrameBufferObject(self, size)
>> - render () (is called when something changes)
>> - synchronize(self, item) (called as a result of QQuickFramebufferObject::update())
>>
>> So I assume these methods are not properly implemented in PyQt and can not be overridden at the moment?
> No, as suspected I hadn't got the ownership issues correct. Try tonight's snapshot.
>
> Phil
Thanks, Phil! It works now.


More information about the PyQt mailing list