Qt-interest Archive, June 2007
Control which buffer QPainter renders to?
Message 1 in thread
How can I control which buffer QPainter paints to when I combine
QPainter with QGLWidget?
In my OpenGl code, I use calls like:
glDrawBuffer(GL_BACK); or GL_FRONT
in rendering my 3D scene.
However, it appears that QPainter always renders to the back buffer.
What I need is to have QPainter paint to the same buffer that I am
indicating for my OpenGl rendering.
Note, I am doing the buffer swap myself and controlling BACK vs. FRONT
for OpenGl rendering since I can do quick 2D XOR line graphics over an
very expensive 3D image without having to re-render it every time.
Mark
--
[ signature omitted ]
Message 2 in thread
I should reword my previous posting a little more carefully....sorry.
My paintGL method now contains a combination of QPainter for 2D line
drawing and OpenGl for 3D rendering of the scene.
The 3D scene can get rather expensive to render. Thus, when the user is
doing a drag-select with the mouse, I want to render a 2D line drawn box
over the 3D image without having to re-render the 3D image with every
update.
I do this by rendering to the front buffer when 2D operations are in
effect and not doing a buffer swap. When I need to update the 3D scene,
I render to the back buffer and do a buffer swap.
Now, it seems that the QPainter is always painting to the back buffer
even when I use:
glDrawBuffer(GL_FRONT).
Hence my question: Is it possible to control which buffer the QPainter
paints to?
Mark
--
[ signature omitted ]