I have added a stackoverflow post which is more detailed and makes it easier to 
see the code. 
https://stackoverflow.com/questions/63937113/incorrect-rendering-using-qsgrendernode-and-qpainters-opengl-backend

________________________________
From: Interest <interest-boun...@qt-project.org> on behalf of Daljit Singh 
<dalji...@live.com>
Sent: Sunday, September 20, 2020 10:36:16 AM
To: interest@qt-project.org <interest@qt-project.org>
Subject: [Interest] QSGRenderNode and OpenGL rendering using QPainter


Hi, I wanted to make use of QSGRenderNode to paint some QML items using third 
party libraries (mainly Skia). So I decided to gave it a go, but I am having a 
trouble on understanding how to properly use this class. I have wrote a simple 
class derived on QQuickItem that essentially paints a QSGRenderNode using its 
updatePaintNode method.

To paint the node, I am currently using QPainter together with 
QOpenGLPaintDevice, but my code produces unexpected results. Here is an example 
https://pastebin.com/BzMzhu41, where I am trying to create an item that paints 
a line from (0,0) to (400,400).

I would expect this code to create a QML Item  (https://pastebin.com/6ZRrMvFi) 
that paints a line from the top-left towards the bottom right of the item, but 
instead the line seems drawn with an incorrect offset.

I suspect this has something to do OpenGL (on which I am not an expert on), but 
not really sure. Could someone point me in the right direction on how to go 
about this?
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to