[Interest] Qt3D not deleting buffers

Juan Jose Casafranca jjcasmar at gmail.com
Wed Oct 5 01:29:35 CEST 2016


Hi Sean,

I've looking the Qt3DWindow code in the repo. I have seen that the
setRootEntity only works well if the window is not shown.

During the expose event, if the userRoot is set as a child of the root. If
after the exposeEvent I call setRootEntity, it will change the m_userRoot
entity pointer, but will not set it as a child of m_root and will not
detach the previous m_rootEntity. Is this on purpose? Should we create a
rootEntity that should stay there for the whole execution? Shouldn't be
possible to just change the m_rootEntity in Qt3DWindow and sets this to be
to the new child of m_root?

To summarize:
This is the Qt5.7, 5.7.1, 5.8 and dev code:

void Qt3DWindow::setRootEntity(Qt3DCore::QEntity *root){
    Q_ASSERT(!isVisible());
    m_userRoot = root;}


And I dont understand why is not something like:

void Qt3DWindow::setRootEntity(Qt3DCore::QEntity *root){
    Q_ASSERT(!isVisible());

    m_userRoot = root;

         m_userRoot->setParent(m_root);

}


Thanks for your time!


2016-10-03 17:26 GMT+02:00 Juan Jose Casafranca <jjcasmar at gmail.com>:

> Hi Sean,
> thanks for your fast reply.
>
> I dont know what is a JIRA. Anyway, I have prepared a very simple example
> where I can reproduce one of the problems I was explaining in my previous
> message.
>  I go through the code:
>
> The main creates the QApplication, a SceneManager and a timer to call
> periodycally a scenemanager slot.
> The SceneManager, during ctor, creates a Qt3DWindow, a root entity and
> calls the changeScene slot.
> The changeScene slot destroys the rootEntity (destroying that way all the
> children) and recreates it. Then it create a new geometry (which basically
> for this example consist on a red plane) and configures the camera.
>
> Right now the window show a red plane... great, no problem.
>
> When the timer timeouts and the changeScene is called again, the process
> is reapeated, but now, no red plane is shown. This is exactly the same
> problem I'm having in the complete code. I dont know why I'm having this
> behavior. With this example, the buffers are correctly deleted, so  I
> imagine I have another problem in the complete code.
>
> Could you provide me some feedback?
>
> Thanks!
>
>
>
> 2016-10-03 13:57 GMT+02:00 Sean Harmer <sh at theharmers.co.uk>:
>
>> Hi,
>>
>> could you file a JIRA please ideally along with a small test case that
>> reproduces the issue.
>>
>> Many thanks!
>>
>> Sean
>>
>> On Monday 03 October 2016 13:40:36 Juan José Casafranca wrote:
>> > Hello!
>> >
>> > I'm posting to act some questions about Qt3D.
>> >
>> > I'm trying to show some information for my program. This information
>> consist
>> > on a regular grid (I'm painting the lines that define the voxels), a
>> > distance map (in each voxel vertex I store a distance value) and the
>> > sources for the distance (zones where distance is 0)
>> >
>> > The software supports resizing the grid or changing the sources so the
>> views
>> > must be updated accordingly. To achieve that, I emit a signal when a
>> change
>> > in the distance or the grid is done and connect that signal to a slot
>> that
>> > performs the scene preparation. It isn't the best solution but for now
>> is
>> > enough.
>> >
>> > The scene preparation slots cleans the previously allocated scene
>> > (m_rootEntity->deleteLater()) and reconstructs the scene.
>> >
>> > The reconstruction generates the geometry data for the different things
>> I
>> > want to view, creates the renderer and the materials and adds this
>> > components to different entities. Finally, this entities are added to
>> the
>> > root entity.
>> >
>> > To reduce code paths, the first view also performs this steps (removes
>> the
>> > previously scene, which is null) and creates the new one. This works
>> well.
>> >
>> > My problem is when trying to delete an existing scene. I have been
>> debugging
>> > with gDEBugger and I have seen that buffers are not deleted (I imagine
>> that
>> > VAO are also kept) though the buffers are constructed with the geometry
>> as
>> > parent, and the geometry es an entity children (the entity is delete
>> when I
>> > delete m_rootEntity).
>> >
>> > After 2 or 3 remeshing steps, the screen goes black and I cant see any
>> > information.
>> >
>> > I'm using the Qt3D version shipped with Qt 5.7.
>> >
>> > Any idea what I'm doing wrong? I can provide some code if you ask for
>> it,
>> > but as the software I'm developing is big, I prefer to show the code
>> when
>> > you ask for it, so I don't fill this question with a lot of code that
>> > wouldn't be necessary.
>> >
>> > Thanks!
>> > _______________________________________________
>> > Interest mailing list
>> > Interest at qt-project.org
>> > http://lists.qt-project.org/mailman/listinfo/interest
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161005/9343dbd4/attachment.html>


More information about the Interest mailing list