Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QObjectPicker - QPickingSettings::TrianglePicking doesn't work with custom mesh

QObjectPicker - QPickingSettings::TrianglePicking doesn't work with custom mesh

Scheduled Pinned Locked Moved Solved General and Desktop
qt3dpickingcustom geometry
3 Posts 2 Posters 775 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JulianM
    wrote on last edited by JulianM
    #1

    Hi,

    I have a custom mesh witch is implemented trough QGeometry -> QGeometryRenderer. In general is a plane from triangles that could be edited.
    My problem is that QObjectPicker doesn't catch the clicking/selections on this plane. Event are not triggered at all.
    I configured QRenderSettings to Qt3DRender::QPickingSettings::TrianglePicking.
    Even when I put AllPicks and FrontAndBackFace still nothing.

    I little mo info for may custom mesh. Here how I configured the Attributes

    _VertexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, this);
    _IndexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, this);
    
    
    // Attributes
    _PositionAttribute = new Qt3DRender::QAttribute();
    _PositionAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
    _PositionAttribute->setBuffer(_VertexDataBuffer);
    _PositionAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
    _PositionAttribute->setVertexSize(3);
    _PositionAttribute->setByteOffset(0);
    _PositionAttribute->setByteStride(9 * sizeof(float));
    _PositionAttribute->setCount(_Grid_W * 2);
    _PositionAttribute->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
    
    _NormalAttribute = new Qt3DRender::QAttribute();
    _NormalAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
    _NormalAttribute->setBuffer(_VertexDataBuffer);
    _NormalAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
    _NormalAttribute->setVertexSize(3);
    _NormalAttribute->setByteOffset(3 * sizeof(float));
    _NormalAttribute->setByteStride(9 * sizeof(float));
    _NormalAttribute->setCount(_Grid_W * 2);
    _NormalAttribute->setName(Qt3DRender::QAttribute::defaultNormalAttributeName());
    
    _ColorAttribute = new Qt3DRender::QAttribute();
    _ColorAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
    _ColorAttribute->setBuffer(_VertexDataBuffer);
    _ColorAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
    _ColorAttribute->setVertexSize(3);
    _ColorAttribute->setByteOffset(6 * sizeof(float));
    _ColorAttribute->setByteStride(9 * sizeof(float));
    _ColorAttribute->setCount(_Grid_W * 2);
    _ColorAttribute->setName(Qt3DRender::QAttribute::defaultColorAttributeName());
    
    _IndexAttribute = new Qt3DRender::QAttribute();
    _IndexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute);
    _IndexAttribute->setBuffer(_IndexDataBuffer);
    _IndexAttribute->setVertexBaseType(Qt3DRender::QAttribute::UnsignedShort);
    _IndexAttribute->setVertexSize(1);
    _IndexAttribute->setByteOffset(0);
    _IndexAttribute->setByteStride(0);
    _IndexAttribute->setCount(_Grid_W * 2 * 3);
    

    Can you help me and tell me what I have to do in order to make this mesh to work normally with QObjectPicker ?
    Thanks.

    P.S. As you can see I am using c++ not QML

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JulianM
      wrote on last edited by
      #2

      Never mind the problem was in my code - /I was not counting correctly the vertices :-)/ Everything works as expected .

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VictorT
        wrote on last edited by
        #3

        hi there, JulianM
        Could you explain a little bitmore, how the vertex count affect the picking? and what was the problem exactly(how it was solved)?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved