[Interest] Qt3D: Create custom meshes and textures in C++, use in QML

Helmut Mülner helmut.muelner at gmail.com
Thu Jul 6 11:09:40 CEST 2017


After studying the (spare) Qt3d documentation and examples and researching
almost all Web resources, I am still not sure how to best solve the
following task:

 

I have to create custom meshes and textures in C++ (the data come from a
database) and I want to use these items in a QML GUI.

At run-time I want to change or replace the meshes and/or textures.

 

For other items (models and other QObjects) I use
QQmlContext::setContextProperty.

I also use image providers.

 

The answer to
https://stackoverflow.com/questions/38847357/use-qt3d-qentity-in-qml-scene3d
shows how to do this with qmlRegisterType  
 and a class derived from
Qt3DCore::QEntity.
I cannot do the addComponent in the constructor, so I would have to use
slots do add and replace components that are called from QML.
Replacements would have to use QEntity::components(), removeComponent and
addComponent.
 
Will this work, and is this the best strategy?
 
Or is it possible to construct some of these in C++ and use them in QML via
setContextProperty: Buffer, Geometry, GeometryRenderer or other classes from
the Qt3D modules?
 
Is anybody out there who has experience with that?
 
Regards,
 
Helmut
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170706/a6e926c9/attachment.html>


More information about the Interest mailing list