[Interest] [Qt3D] Update vertex buffer data together with increasing count of vertices leads to artifacts

Oleg Evseev ev.mipt at gmail.com
Sat Apr 22 01:04:54 CEST 2017


Hi,

I frequently update geometry with help of updateData function of vertex
QBuffer, increasing vertices count with help of setCount function of
geometry position QAttribute like this:

    uint vertexCount = positionAttribute->count();

vertexBuffer->updateData(vertexCount*3*sizeof(VERTEX_TYPE),appendVertexArray);
    positionAttribute->setCount(vertexCount+2);

(initial data of vertexBuffer of course has enough space for updates)

Sometimes (especially with high frequency updates) I observe temporary very
short time visual artifacts - triangles (faces) based on newly added
vertices jump somewhere aside, but then "come back" to the place they
should be.

As for me it all looks like setCount get to qt3d rendering backend and
"goes down" to opengl calls before updateData, so data that is in current
(not yet updated) vertex buffer on the place of new vertices (some scrap)
is used in rendering and leads to artifacts. And only after that buffer
data is finally updates.
(sorry if I'm not correct in qt3d backend work aspects)

Also finally when I don't need updates anymore, I want to reduce size of
vertexBuffer data like this:

QByteArray vertexArray = vertexBuffer->data();
vertexArray.detach();
vertexArray.resize((vertexCount+2)*3*sizeof(VERTEX_TYPE));
...
vertexBuffer->setData(vertexArray);
positionAttribute->setCount(vertexCount+2);

This one leads sometimes (not always) to artifacts that remains, that is
faces based on new vertexes are goes somewhere out of the screen (probably
to 0 coordinate) and do not change anymore.

Also in contrast with updateData I can't understand and trace chain how
changing count of vertex attribute goes down finally to opengl calls.

Thank in advance for help.

--
With regards, Oleg.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170422/35d829d1/attachment.html>


More information about the Interest mailing list