[vtkusers] Stereomode of Renderwindow with Qt / QVTKWidget

Clinton Stimpson clinton at elemtech.com
Thu Oct 30 10:13:53 EDT 2008


Its because the OpenGL context has already been created.  However, you 
can call

ui.vtkWidget->GetRenderWindow()->Finalize()

before you tell it you want stereo support.
Then it'll re-create the context with the support you need.

I think you need VTK 5.2 for that to work.

Clint

Hegenbart, Lars wrote:
> 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
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   





More information about the vtkusers mailing list