[Interest] Custom QQuickItem and Geometry Batching

Gunnar Sletta gunnar at sletta.org
Wed Oct 8 08:10:09 CEST 2014


On 07 Oct 2014, at 15:37, Andreas Schuller <andreas.schuller at student.tugraz.at> wrote:

> 
> On 10/07/2014 12:46 PM, Gunnar Sletta wrote:
> [...]
>>> Is it possible to utilize the z-coordinate of the vertices for this
>>> purpose (within a QuickItem)? Or is there a better solution?
>> 
>> You have two options. Either you rely on scene graph's internal batching algorithm, (which will probably be sufficient) or you hook your GL up to beforeRendering and do custom GL behind the UI.
>> 
>> If you choose to rely on the internal batching, the only thing you need to take care of is that your lines's materials are equal (QSGMaterial::compare() for all instances will return 0), that your labels compare return 0. The markers need to be changed from point sprites to triangles to allow batching though. We only try to batch GL_TRIANGLE and GL_TRIANGLE_STRIP.
> 
> thank you for your advice!
> 
> What I haven't mentioned is, that the position of each object changes 
> continuously (e.g. every second) and the number of objects varies from 
> frame to frame. Additionally, the scene may be rendered in up to 5 windows.
> 
> The results of the "Flying Icons" benchmark are impressive. But IHMO, 
> creating and maintaining a large tree of small geometry nodes is a bit 
> wasteful in my case. Maybe, it's better to do custom GL by using 
> QQuickFramebufferObject instead.

Yeah, going through an FBO is another way to do raw GL. It comes with a bit of overhead compared to using the beforeRendering() signal, but has the benefit that it integrates with the rest of the rendering, clipping and opacity and such. On a desktop it will in all likelyhood be fine. For an embedded system, you should verify that the performance is acceptable before choosing it. 

cheers,
Gunnar

> 
> Cheers,
> Andreas
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list