2

I have code which generates a mesh, i.e., as a N x 3 array of doubles V of the 3D points and another M x 3 array of integers F of the triangles. How can I render this mesh via qt3d (note the mesh is generated and hence not loaded from a file)? The task is so basic that it seems it should be straightforward but it seems qt3d is highly underdocumented.

olamundo
  • 23,991
  • 34
  • 108
  • 149
  • 1
    Unfortunately there is no easy way to do this. You need to create your own `QGeometryRenderer`, `QGeometry`, `QBuffer`, and `QAttribute` instances to render custom geometry. I will try and respond a bit later with details on how to do this. – ajshort Jan 25 '16 at 05:27
  • 1
    @ajshort - thanks! So considering this is undocumented as far as I can tell, and also if the code itself would be kinda cumbersome (sounds almost more cumbersome than directly using OPENGL), then what are the upsides of using qt3d? – olamundo Jan 25 '16 at 12:31

1 Answers1

0

The Qt3D sources provide an example of how to do it for a simple cube: qt3d\src\extras\geometries\qcuboidgeometry.cpp/.h qt3d\src\extras\geometries\qcuboidmesh.cpp/.h You can probably adapt it to your use case.

mic
  • 201
  • 2
  • 4