Simple example of displaying a point in Qt3D



  • I'm porting an application based on Qt3D v.1 to Qt3D v.2 (Qt5.7).

    As a very simple starting place I just need to display a bunch of points (ideally with colour and size). Are there any examples of such a simple application?

    Thanks, Dave.



  • @daffmeister

    Hi and welcome to devnet forum

    Would this be sufficient Qt3D examples?



  • Thanks @koahnig,

    I've looked at the examples but they implement meshes with material properties, which I think is too heavy for what I need (ultimately a point cloud with 100,000's of points, so a sphere with fancy shading isn't going to work).



  • @daffmeister

    You would have to "thin out" one of the examples I guess. At least that would be my approach. Unfortunately I am not in QML and useless there.



  • Hi @koahnig,

    That's what I've done so far, giving me this fragment:

    Qt3DCore::QEntity *createScene()
    {
        Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity;
        Qt3DRender::QMaterial *material = new Qt3DExtras::QPhongMaterial(rootEntity);
        Qt3DCore::QEntity *sphereEntity = new Qt3DCore::QEntity(rootEntity);
        Qt3DExtras::QSphereMesh *sphereMesh = new Qt3DExtras::QSphereMesh;
        ...
        (set sphereMesh properties)
        ...
        sphereEntity->addComponent(sphereMesh);
        sphereEntity->addComponent(material);
        }
        return rootEntity;
    }
    

    which I then view. That only scales to about a thousand points though before it starts slowing down (not surprising since it's rendering actual spheres). So I need simpler primitives.



  • @daffmeister

    I will mark this post and call for moderation. Someone else should be of more use here.



  • Hello,

    I created a Qt3DPointcloudRenderer https://github.com/MASKOR/Qt3DPointcloudRenderer

    It can render Pointcloud Library PCLPointcloud2.

    If you already have your Vertexbuffer ready, you can simply use

    GeometryRenderer {
        geometry: (...)
        primitiveType: GeometryRenderer.Points
    }
    

    and RenderState

    StateSet {
        renderStates: [
            PointSize { specification: PointSize.Programmable },
            (...)
        ]
    }
    

    (PointSize seems to be broken in Qt version 5.7. The Application might crash on exit.)



  • @Dabulla Hi! Would be great if you'd file a bug report for this PointSize RenderState issue. Thank you :)


 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.