[Interest] 2D painting toggle between raster and opengl. What is the advised method?

Mark Gaiser markg85 at gmail.com
Sat Nov 8 17:28:49 CET 2014


Hi,

The requirement are simple: 2D painting needs to be possible and i
want to toggle between raster and OpenGL. QML or _depending_ on the
GPU is out of the question. Animations are also not required. Things
that are required are zoomnig controls, selecting drawn objects and
rendering has to be high performance. It must be capable of drawing a
_lot_ of primitive objects (think about numbers between 100.000 and 1
million).

Given those requirements i know of two different ways to accomplish
the same result.

1. QWidget and QOpenGLWidget (new in Qt 5.4). They would both use
QPainter. Basically the 2dpainting example [1] that is provided with
Qt.

2. Using QGraphicsView. It defaults to raster based painting and can
be accelerated by calling setViewport(new QOpenGLWidget) on it. This
can be done in basically all of the GraphicsView examples [2].

Those are the options that i know of where it's possible to toggle
between hardware and software rendering. Is this it or are there even
more options out there in the Qt world?

It's unclear to me which of the possible options is the advised way to
go when drawing something in 2D. Therefore my question: which one
would be the advised way to use given the requirements said earlier?

[1] https://qt.gitorious.org/qt/qt/source/examples/opengl/2dpainting
[2] https://qt.gitorious.org/qt/qt/source/examples/graphicsview



More information about the Interest mailing list