# Changing QSurfaceFormat of a ThreeDWidget

**URL:** <https://discourse.slicer.org/t/changing-qsurfaceformat-of-a-threedwidget/18111>\
**Category:** Development\
**Created:** [June 14, 2021, 12:55pm UTC](https://discourse.slicer.org/t/changing-qsurfaceformat-of-a-threedwidget/18111 "2021-06-14T12:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarineC](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MarineC](https://discourse.slicer.org/u/MarineC)\
**Post date:** [June 14, 2021, 12:55pm UTC](https://discourse.slicer.org/t/changing-qsurfaceformat-of-a-threedwidget/18111/1 "2021-06-14T12:55:22Z")

</div>

Hello everyone,

I am trying to show a 3D view outside the view layout, to be able to activate the QuadBuffer stereo mode on Slicer 4.13 (with VTK9). I followed [this example](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#show-a-3d-view-outside-the-view-layout) for the widget but using C++.

First, I created a VTK app which used [QVTKOpenGLStereoWidget](https://vtk.org/doc/nightly/html/classQVTKOpenGLStereoWidget.html) and I had to change the surface of the widget like this:

```auto
QVTKOpenGLStereoWidget widget;
QSurfaceFormat format;
format.setStereo(true);
widget.setFormat(format);

```

Or like this : `QSurfaceFormat::setDefaultFormat(QVTKOpenGLStereoWidget::defaultFormat(1));`

With the surface like this and some others parameters for the render window it works like a charm.

My problem is, now that I want to do it in Slicer, I must use the class threeDWidget. However, from what I understood, I cannot change the format of the ThreeDWidget (in the class [qMRMLThreeDWidget](http://apidocs.slicer.org/master/classqMRMLThreeDWidget.html#aa489037124728d003ccc34b1c4207517)), so I would like to know if there is another way for me to use the format I need. Or if I can use a Stereo widget inside Slicer rather than the threeDWidget class, so I’ll have direct access to the surface as I seen above.

Thank you for your help !

Regards

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 7, 2021, 7:08pm UTC](https://discourse.slicer.org/t/changing-qsurfaceformat-of-a-threedwidget/18111/2 "2021-09-07T19:08:50Z")

</div>

Have you figure this out? Have you managed to make the zspace device work in Slicer?
