Can I directly access the vertex-buffer of a QQuickItem or do I have to use openGL itself?
-
He guys,
I'm just starting to write a 2D line chart component to display allot of data per second (to use in a qt-quick application).
I wrote such component before in directx and want to migrate it to qt now.What I did in directx:
I created a vertexbuffer which holds the data for one chart-line.
Every time I add data to the chart I increment an index-counter which stores the actual write position.
When the pointer reaches the end of my buffer I jump back to 0. This way I have a ring buffer.
Then I just have to perform 1-2 drawings of linestripes:
e.g.:
(56)(2345)
(567)(345)
(5678)(45)
(56789)
(90)(6789)
(901)(789)
(9012)(89)
...
As you can see I'm only modifying the vertex buffer in a minimal way.Now I'm not sure how to port it to QT.
Should I use directly openGL or can I use a QQuickItem and implement a updatePaintNode function.
On first glance it looks like QSGeometry etc. is mapping quite close to opengl but I don't see a way to modify the vertex-buffer directly.When I use geometry->vertexDataAsPoint2D() to access data, I have to mark the complete data as dirty and qt will upload the complete vertex buffer. I'm not sure how much performance this will cost as my vertex buffer will have a size of around 30000 entries and I will add data every millisecond.
Thanks for your help
mts -
Hey,
take a look at this read its a reference so it should be work.
-
vertexData() returns only the data in ram and not the real VBO which is stored in GPU-ram.
As soon as you mark it as dirty it gets completely copied into GPU.Meanwhile I have implemented a direct opengl-way where I create the VBO myself.
Thanks anyway!
cu
3/3