[vtkusers] Stereomode of Renderwindow with Qt / QVTKWidget

Hegenbart, Lars Lars.Hegenbart at hs.fzk.de
Thu Oct 30 08:21:56 EDT 2008


Dear VTK-community,

I want to switch on the stereo-mode (pressing key "3") in a
QVTKWidget-Window. It seems that MacOSX supports this by default.
Compiling this on windows causes trouble. I found some lines of code for
turning the capability on and added it to the code. But now, an error
message (at runtime) tells me this:

"Warning: In
/Users/andy/Develop/VTK/VTK/Rendering/vtkCarbonRenderWindow.cxx, line
1063
vtkCarbonRenderWindow (0x185da00): Requesting a StereoCapableWindow must
be performed before the window is realized, i.e. before a render."

Here some relevant code parts:

In the header:
vtkRenderer* ren;

In the class-file:
vtkMyViewer::vtkMyViewer(QWidget *parent) : QDialog(parent)
{
	ui.setupUi(this);
	// needed for Windows: start
	ui.vtkWidget->GetRenderWindow()->StereoCapableWindowOn();
	ui.vtkWidget->GetRenderWindow()->SetStereoTypeToRedBlue();
	ui.vtkWidget->GetRenderWindow()->StereoRenderOff(); //On();
	ui.vtkWidget->GetRenderWindow()->StereoUpdate();
	// needed for Windows: end
	ren = vtkRenderer::New();
	ui.vtkWidget->GetRenderWindow()->AddRenderer(ren);
...

The problem is: the .ui-file (which was generated with the Qt-Designer)
of the Qt-Widget which includes the QVTKWidget) is processed by "moc"
and "uic" to generate moc and ui_...h files automatically, so I cannot
set the Stereomode in the QVTKWidget earlier in my code than in the
constructor. 

Did someone came across this before? How to set the
StereoCapableWindowOn() for the QVTKWidget earlier? Any idea, strategy,
suggestions?

Thanks in advance!

Cheers
Lars




More information about the vtkusers mailing list