[vtkusers] How to put Qt widgets on top of a VTK OpenGL scene
Elvis Dowson
elvis.dowson at mac.com
Tue Oct 21 07:02:46 EDT 2008
Hi Clint,
Just guessing here, when I use QWidget, the painter
associated with the QGraphicsView with use a normal paint engine (in
my case, type 3 which corresponds to Mac OS Core Graphics).
However, the moment I switch to QGLWidget, the painter associated with
the QGraphicsView will use an OpenGL paint engine (type 7). So, for
the openGL drawing to occur in the QGLWidget, I will some how have to
integrate it with VTK.
So, now going by what you have done before, the simplest way to
integrate it as a first step would be to create a new paint engine and
re-implement the QPaintEngine::drawPixmap() method, correct?
Then, after that, if you re-implement all the other QPaintEngine
methods, such as drawEllipse, drawPoints, drawLines, etc, using VTK
drawing commands, or setting it up so that it uses the following vtk
classes
- vtkPainterDeviceAdapter (e.g. DrawElements() method which has types
for lines, vertex, triange, etc)
- vtkOpenGLPainterDeviceAdapter
or something like that to somehow get Qt to use the VTK OpenGL
commands to directly render into the QGLWidget's OpenGL rendering
context?
Whew, this stuff is crazy and I feel like I'm groping in the dark.
Clint, atleast, now I see how you have implemented the QVTKWidget, and
the reasons behind your previous prototypes.
Best regards,
Elvis Dowson
On Oct 21, 2008, at 2:37 PM, Elvis Dowson wrote:
>
> What could be going wrong or preventing me from using QGLWidget to
> render the OpenGL images? Is it because the commands executed in the
> drawBackground method wasn't OpenGL ? Does this mean that if
> somehow, I got the QGLWidget to share the OpenGL context with the
> vtkRenderWindow, VTK will automatically catch and render the VTK
> images using a shared OpenGL context?
>
More information about the vtkusers
mailing list