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

List:       pykde
Subject:    Re: [PyQt] Creating a QSGGeometry.AttributeSet in PyQt5
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2014-02-22 14:33:20
Message-ID: dbe95aeb2c328a1a4b260c3df7edaa13 () www ! riverbankcomputing ! com
[Download RAW message or body]

On 21-02-2014 1:08 pm, pwuertz wrote:
> Hi,
> I am trying to add a vertex array to a QSGGeometryNode for a custom 
> QtQuick
> Item. Qt5 uses QSGGeometry for that purpose and requires the user to 
> define
> a QSGGeometry.AttributeSet that describes structure of a vertex 
> array. There
> are a few pre-defined structures like the one from
> defaultAttributes_Point2D() but I need to create my own as described 
> in
> http://qt-project.org/doc/qt-5/qsggeometry.html.
>
> QSGGeometry::Attribute MyPoint2D_Attributes[] = {
>     QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true),
>     QSGGeometry::Attribute::create(1, 4, GL_FLOAT, false)
> };
>
> QSGGeometry::AttributeSet MyPoint2D_AttributeSet = {
>     2,
>     sizeof(MyPoint2D),
>     MyPoint2D_Attributes
> };
>
> The problem is that I don't know how to create a 
> QSGGeometry.AttributeSet in
> PyQt5, which C++ creates by struct initialization. AttributeSet 
> doesn't have
> an initializing constructor and naively assigning a list of 
> Attributes to a
> default constructed instance fails because AttributeSet.attributes is
> read-only. How can I construct a complete AttributeSet in PyQt5?

Tonight's snapshot will have a AttributeSet ctor that takes a stride 
and a sequence of Attributes so that you can do...

attribute_set = QSGGeometry.AttributeSet(24,
     (QSGGeometry.Attribute.create(0, 2, QSGGeometry.GL_FLOAT, True),
      QSGGeometry.Attribute.create(1, 4, QSGGeometry.GL_FLOAT, True)))

It's very likely that there are other problems with the QSGGeometry 
API. Please let me know if you find other things that you need to be 
able to do but can't.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://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