[Qt-interest] QPainter background on QGLWidget
John Clayton
john_clayton at me.com
Mon Dec 14 05:07:07 CET 2009
Hi Sean
I have had a similar issue recently.
In 4.6 there's a bunch of OpenGL state that is kept in the QPainter,
that wasn't kept there in 4.5.3 (someone correct me if I'm wrong),
e.g. clipping paths are now deployed as shaders, and that's all hidden
inside the Q2GLPaintEngineEx implementation (private) - as far as I
can see - thats a problem if you then combine operations like this:
1. do stuff - that relies on QPainter state
2. do some OpenGL stuff that has no idea about QPainter state
because 'pure' opengl code doesn't know about the shaders et al. I
tried downloading the code, and wrapping the drawing of the cube in
painter.beginNativePainting / painter.endNativePainting
no luck there either
sorry not to have a solution - but I thought I'd share my experience
so far in mixing GL with the new QPainter calls. My solution was to
patch the 4.6 sources. In my case I needed to be able to draw
textures using the new QPainter based calls - which are NOT exposed on
QGLWidget / QGLContext.
--
John Clayton
Skype: johncclayton
On Dec 14, 2009, at 3:09 AM, Sean Hignett wrote:
> Hello all,
>
> I am new to Qt, and working on some OpenGL sample code from the C++
> Gui Programming book. The VowelCube example demonstrates the
> ability to use QPainter "behind" OpenGL rendering. It uses a
> radiant gradient background, and then paints an OpenGL cube over top
> (or so it is supposed to).
>
> When I use the downloaded sample code with Qt 4.6 (vowelcode),
> everything works, but the actual OpenGL cube is not rendered. If I
> comment out the QPainter based background (drawBackground), the cube
> will render.
>
> http://www.informit.com/articles/article.aspx?p=1405557&seqNum=2
> (code and example shown here)
>
> Again, this is code taken from the C++ Gui Programming book based on
> Qt 4.3. Has something changed since that version with respect to
> this functionality? Trying get this to work as depicted is making
> me bald :)
>
> Working on Qt 4.6 on OSX, but tried on Ubuntu as well, same result.
>
> Thanks,
> Sean
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list