[Interest] QSGRenderNode and OpenGL rendering using QPainter

Daljit Singh daljit97 at live.com
Sun Sep 27 15:04:40 CEST 2020


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-bounces at qt-project.org> on behalf of Daljit Singh <daljit97 at live.com>
Sent: Sunday, September 20, 2020 10:36:16 AM
To: interest at qt-project.org <interest at 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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200927/1142708f/attachment.html>


More information about the Interest mailing list