Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
Description
The attached testcase doesn't draw the triangle through OpenGL when QPainter is created in QOpenGLWidget::paintGL().
This is contrary to what documentation (https://doc.qt.io/qt-5/qopenglwidget.html) says:
It is also possible to draw 2D graphics onto a QOpenGLWidget subclass using QPainter: * In paintGL(), instead of issuing OpenGL commands, construct a QPainter object for use on the widget. * Draw primitives using QPainter's member functions. * Direct OpenGL commands can still be issued. However, you must make sure these are enclosed by a call to the painter's beginNativePainting() and endNativePainting().
Command to compile the testcase:
c++ -std=c++20 -fPIC testcase-painting-fails-in-QOpenGLWidget+QPainter.cpp `pkg-config --cflags --libs Qt5Core Qt5Widgets Qt5OpenGL` -I /usr/local/include -L /usr/local/lib -lGL