[Interest] Using QPainter in a QOpenGLFrameBufferObject

Thomas Sevaldrud thomas at silentwings.no
Mon Nov 30 11:57:11 CET 2015


Hi,

I'm using QPainter to draw some text and other primitives into a
QOpenGLFrameBufferObject which is used as a texture in my OpenGL scene.

I use QPainter::drawText, drawPath and fillRect. The drawText() call seems
to work as expected, but the two other produce more or less random garbage.
I suspect that the OpenGL state is messed up before I enter the QPainter,
but I'm not sure which states I need to keep track of.

I know about the QPainter::beginNativePainting/endNativePainting, but these
are typically used when you want to draw OpenGL commands inside a QPainter.
This is more the other way around, i.e I want to draw QPainter stuff inside
a GL renderer. Anyway, I've tried different combinations of
begin/endNativePainting but with no effect.

What is the recommended way of doing this? Should I make a separate GL
context for my FBO rendering, or is it possible to keep the state consisten
between the two renderers.

- Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151130/30ef7da7/attachment.html>


More information about the Interest mailing list