[vtkusers] How to put Qt widgets on top of a VTK OpenGL scene
Elvis Dowson
elvis.dowson at mac.com
Wed Oct 15 15:54:59 EDT 2008
Hi,
vtkRenderWindow has the following abstract
methods to retrieve pixel data. Oh, wow, now I get it. Clint, I think
your approach takes the data from the correct location, anyway, as far
as blending the vtk OpenGL image data and the Qt generated widget
image data.
vtkRenderWindow::GetPixelData()
vtkRenderWindow::GetRGBAPixelData()
Hmm, wonder where that leaves us? Check to see if the VTK OpenGL
pipeline commands work ?
Continuing the analysis..
vtkRenderWindow is implemented by vtkOpenGLRenderWindow, implements
the GetRGBAPixelData method.
So, here is the interesting stuff, QVTKWidget has two methods
QVTKWidget::saveImageToCache()
QVTKWidget::paintEvent()
which utilises the GetPixelData(), SetPixelData() and
GetRGBACharPixelData() methods.
When a QVTKWidget::paintEvent() is called, it calls the
vtkRenderWindow::SetPixelData() to draw the image onto the render
window. But at this stage it is still very much in the realm of the
vtk controlled OpenGL render windows, more specifically Carbon or X11
or Win32 OpenGL rendering contexts.
I'm just thinking out aloud here, we need some way to merge the OpenGL
pixel data with the Qt generated pixel data, within the QGLWidget
implementing OpenGL, as a first steps, so that all pixel data
manipulations are internal to QVTKWidget's implementation, i.e. get
QVTKWidget to subclass from QGLWidget and add additional methods to
support merging of the OpenGL generated pixel data from both VTK and
Qt within the drawBackground() method.
I'm not sure where I'm going with all this, but if you have any
comments on steering me in the right direction, it will welcome!! :-)
Best regards,
Elvis Dowson
More information about the vtkusers
mailing list