Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50720

Qt3D change and modify vertexes and indexes arrays with preallocation

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • None
    • 5.6.0 Beta
    • Qt3D
    • None
    • c818f3b70cdcac27b8aaff0b53a5790beebba9e7

    Description

      I want to use Qt3D in a situation that involves dynamic runtime changes of geometric data on the application side (car tracking path).
      I filled QByteArrays with vertexes, normals, colours, indexes and used them in functions setData of QBuffers (by analogy with custom-mesh-cpp example). Than on every car movement I append (or modify preallocated) data in QByteArrays, use functions setData of QBuffers again, and modify QAttributes accordingly.

      It works - shows path on Windows and Android in real time. But when there are too many vertexes it crash with std::bad_alloc (if I setData for such huge array by once - all works without crash).
      As I understand correctly this is because Qt3D on every setData allocate data for new GLBuffer, and after all there is no continuous block space left that size.
      (I am new in it and didn't dug up through source code neatly, but I think functions glBufferForRenderBuffer(Buffer *buf) and createGLBufferFor(Buffer *buffer) in graphicscontext.cpp are responsible for that)

      There: http://lists.qt-project.org/pipermail/interest/2015-October/019238.html Sean Harmer suggested for dynamic mesh

      >... update the above objects on the main thread and call update()

      I didn't found any update() function in QGeometry, QGeometryRenderer or QEntity.

      There is update() function in glbuffer.cpp and it use glBufferSubData the OpenGL function for updates a subset of a buffer object's data store - what I need! But (if I understand correctly) it used internally and there is not way to call it from upper layer like QGeometry.

      So If there is no other way to modify mesh data than I wrote, it would be great to get the possibility to execute preallocation of GLBuffer and than modify it data.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lemire_p Paul Lemire
            lukegluke Oleg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes