[vtk-developers] Anti-aliasing / multi sampling in QVTKWidget2 ?

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Jan 13 10:36:05 EST 2015


Hi Thomas,

What version of Qt did you test that with? If that approach works it
sounds reasonable to me, and I would be happy to help get such a patch
through the review process.

Thanks,

Marcus

On Tue, Jan 13, 2015 at 4:08 AM, Kilgus, Thomas
<t.kilgus at dkfz-heidelberg.de> wrote:
> Hey Marcus,
>
> thanks for your answer. We figured out that, what is needed to make it work again:
>   QGLFormat newform = this->format();
>   newform.setSampleBuffers(true);
>   newform.setSamples(8);
>   this->setFormat(newform);
>
> Wouldn't it make sense to add this code to the constructor of the QVTKWidget2 in order to achieve the same behavior as QVTKWidget? Alternatively, a note in the documentation would be nice. Let me know if we can contribute anything like this.
>
> Regards,
> Thomas
>
>
> -----Ursprüngliche Nachricht-----
> Von: Marcus D. Hanwell [mailto:marcus.hanwell at kitware.com]
> Gesendet: Montag, 12. Januar 2015 15:36
> An: Kilgus, Thomas
> Cc: vtk-developers at vtk.org
> Betreff: Re: [vtk-developers] Anti-aliasing / multi sampling in QVTKWidget2 ?
>
> On Mon, Jan 12, 2015 at 5:24 AM, Kilgus, Thomas <t.kilgus at dkfz-heidelberg.de> wrote:
>> Dear List,
>>
>> we recently switched from QVTKWidget to QVTKWidget2 and now by default
>> anti-aliasing is disabled.
>>
>> We managed to track the issue down with this VTK example:
>>
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Qt/RenderWindowUISingleInheri
>> tance
>>
>> Just render the sphere in wireframe mode. If you run the example with
>> a QVTKWidget, lines are smooth and with QVTKWidget2 they are stepped.
>> SetMultiSamples(8) should do the job, but this does not have any
>> effect (and is the default value).
>>
>> Any ideas on this?
>>
> As QVTKWidget reuses Qt's QGLWidget you must use the Qt API for any OpenGL context settings. Multisampling is one of the things that must be done as the context is created, and so cannot be done by VTK.
>
> I can't remember the API off the top of my head, but I know Qt has API in 4 at least for antialiasing. Qt 5 does not, but the new QOpenGLWidget does - QGLWidget lost a number of features that seem to have been reintroduced in this class in the 5.4 release.
>
> Hope that helps clear this up a little.
>
> Marcus


More information about the vtk-developers mailing list