[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Subclass QQuickFramebufferObject::Renderer and QOpenGLFunctions?
From:       Elvis Stansvik <elvstone () gmail ! com>
Date:       2018-11-11 14:45:24
Message-ID: CAHms=ebZ2kzWysZ15M+SFUDEqX_j1b4aYF-boGeKd8AOxxHQ-w () mail ! gmail ! com
[Download RAW message or body]

Den sön 11 nov. 2018 kl 13:40 skrev Elvis Stansvik <elvstone@gmail.com>:
> 
> Hi all,
> 
> How can I subclass both QQuickFramebufferObject::Renderer and
> QOpenGLFunctions, as done by the ColorRenderer in the
> tst_qquickframebufferobject.cpp autotest in Qt:
> 
> https://code.woboq.org/qt5/qtdeclarative/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp.html
>  
> Snipped from above:
> 
> class ColorRenderer : public QQuickFramebufferObject::Renderer,
> protected QOpenGLFunctions
> {
> public:
> void render();
> void synchronize(QQuickFramebufferObject *item);
> QOpenGLFramebufferObject *createFramebufferObject(const QSize &size);
> 
> QSize textureSize;
> QColor color;
> bool msaa;
> };
> 
> I tried to do something like this using the _QOpenGLFunctions_4_1_Core
> class from PyQt, but ran into problems since the metaclass of
> _QOpenGLFunctions_4_1_Core is module, and the meta class of
> QQuickFramebufferObject::Renderer is sip.wrappertype, and there's no
> way to declare a metatype inheriting them both that could be used,
> since they are incompatible at the C level.
> 
> Is it simply not possible to create a
> QQuickFramebufferObject::Renderer like this using PyQt?
> 
> Anyone know of another way to create a custom QQuickFramebufferObject from PyQt?

I think I found the example I needed now:

    https://github.com/Upcios/PyQtSamples/tree/master/PyQt5/opengl/opengl_under_qml_fbo


Looks like

    self.gl = self.window.openglContext().versionFunctions( self.profile )

is one way of getting an QAbstractOpenGLFunctions for a given
QOpenGLVersionProfile (where self.window is the QQuickWindow).

Have not tried it yet, but this should get me started I think.

Elvis

> 
> Cheers,
> Elvis
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic