[Interest] Rendering simple QPainterPath with Qt3D

Ch'Gans chgans at gna.org
Wed Mar 16 05:32:29 CET 2016


On 15 March 2016 at 22:34, Sean Harmer <sean.harmer at kdab.com> wrote:
> On Tuesday 15 Mar 2016 17:41:07 Ch'Gans wrote:
>> On 14 March 2016 at 22:03, Sean Harmer <sean.harmer at kdab.com> wrote:
>> > On Monday 14 Mar 2016 16:50:32 Ch'Gans wrote:
>> >>
>> >> Could anyone shed some light on how I could achieve this, like is the
>> >> custom QMEsh/Geometry the right approach for this kind of problems?
>> >
>> > If you want to extrude, then yes you need actual geometry so investigating
>> > QGeometry is the way to go. Basically, you provide a QBuffer containing
>> > your per-vertex data (positions, but maybe also normal vectors if you
>> > want lighting, texture coordinates if you want to apply a texture, vertex
>> > colors if you want to use the per-vertex colour material etc).
>> >
>> > You then define one or more QAttributes that correspond to these
>> > per-vertex
>> > attributes. The QAttributes describe the layout of the data in the
>> > QBuffer.
>> >
>> > You can then specify the QGeometry that contains the attributes in a
>> > QGeometryRenderer component.
>>
>> Wow!!!
>> Thanks for this explanation, it sounds so easy said this way! ;)
>>
>> I saw this QAttribute thing, but didn't bother digging further. But
>> now I have a better picture on how all this works.
>> Again, thanks a lot for your enlightening comments.
>>
>> Maybe it would be nice to have a cpp example that show this. That was
>> my blocker as I went through all the examples, there's the case where
>> you load your model from a file, there's an example where you use
>> built-in geometry (Cuboid, Sphere, ...), and that was it, nothing
>> about custom geometry. (Don't get me wrong I'm not ranting, what you
>> guys are doing is awesome, as it has always been.)
>
> How about the cunningly named custom-mesh-cpp example? ;)
>
> https://code.woboq.org/qt5/qt3d/examples/qt3d/custom-mesh-cpp/main.cpp.html
>
> Replace the buffer contents with your own geometry for a starting point.

Oops! Missed that one. Really worth it, just for the ASCII art! :P

Thanks,
Chris

>
> Cheers,
>
> Sean
> --
> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> KDAB (UK) Ltd, a KDAB Group company
> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> Mobile: +44 (0)7545 140604
> KDAB - Qt Experts



More information about the Interest mailing list