[vtkusers] Transparent vtkRenderer with Qt

Clinton Stimpson clinton at elemtech.com
Thu Apr 29 00:52:30 EDT 2010


I'm not exactly clear on what you want... but if you're asking for the main window to be transparent then just call QWidget::setWindowOpactity(...)  on it.  It works on platforms with composite support.

Clint

On Apr 28, 2010, at 8:44 AM, Francois Bertel wrote:

> I don't think you can do that with Qt. The OpenGL area is not on top
> of the Qt window, it is owning this part of the window. I don't think
> you can blend an OpenGL area.
> 
> Maybe somebody else can help. It is becoming more a Qt/OpenGL question
> than a vtk question.
> 
> 
> PS: please keep the discussion on the mailing list.
> 
> 
> On Wed, Apr 28, 2010 at 10:21 AM, Guillaume DARDENNE
> <guillaume.dardenne at telecom-bretagne.eu> wrote:
>> 
>> Thank you very much for your answer.
>> 
>> 
>> 
>> I integrated your code :
>> 
>> renWin->SetAlphaBitPlanes(1);
>> 
>> 
>> 
>> but the background is still black. Do you have any ideas ?
>> 
>> 
>> 
>> 
>> 
>> Thank you.
>> 
>> 
>> 
>> Guillaume
>> 
>> 
>> 
>> -----Message d'origine-----
>> De : vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] De la part de Francois Bertel
>> Envoyé : mercredi 28 avril 2010 15:43
>> À : vtkusers at vtk.org
>> Objet : Re: [vtkusers] Transparent vtkRenderer with Qt
>> 
>> 
>> 
>> Hello Guillaume,
>> 
>> 
>> 
>> First you need a renderwindow with some alpha (this is false by default):
>> 
>> 
>> 
>> vtkRenderWindow *renWin = vtkRenderWindow::New();
>> 
>> renWin->SetAlphaBitPlanes(1);
>> 
>> 
>> 
>> There is no API to set a specific opacity on the background color,
>> 
>> however, the hardcoded alpha value is 0 (this actual code is in
>> 
>> VTK/Rendering/vtkOpenGLRenderer::Clear() ), if your use case is to
>> 
>> have a fully transparent background.
>> 
>> 
>> 
>> Still in the case of a fully transparent background, the other way to
>> 
>> set it, is to assign the layer of the renderer to be a value greater
>> 
>> than 1. By default it is 0, a value greater than 1 will set the
>> 
>> renderer on an overlay. (see vtkRenderer::SetLayer() )
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Wed, Apr 28, 2010 at 8:21 AM, Guillaume DARDENNE
>> 
>> <guillaume.dardenne at telecom-bretagne.eu> wrote:
>> 
>>> Dear Vtk users,
>> 
>>> 
>> 
>>> 
>> 
>>> 
>> 
>>> I insert a vtk widget in a Qt widget with the QVtkWidget class.
>> 
>>> 
>> 
>>> I would like to make the vtkWidget transparent.
>> 
>>> 
>> 
>>> I know that it’s possible to set the backward color with the
>> 
>>> setRendererBackground(double, double, double) function but is it possible to
>> 
>>> set also the opacity of this renderer window ?
>> 
>>> 
>> 
>>> 
>> 
>>> 
>> 
>>> Thank you very much for your answers.
>> 
>>> 
>> 
>>> 
>> 
>>> 
>> 
>>> Guillaume
>> 
>>> 
>> 
>>> _______________________________________________
>> 
>>> Powered by www.kitware.com
>> 
>>> 
>> 
>>> Visit other Kitware open-source projects at
>> 
>>> http://www.kitware.com/opensource/opensource.html
>> 
>>> 
>> 
>>> Please keep messages on-topic and check the VTK FAQ at:
>> 
>>> http://www.vtk.org/Wiki/VTK_FAQ
>> 
>>> 
>> 
>>> Follow this link to subscribe/unsubscribe:
>> 
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>> 
>>> 
>> 
>>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> 
>> François Bertel, PhD  | Kitware Inc. Suite 204
>> 
>> 1 (518) 371 3971 x113 | 28 Corporate Drive
>> 
>>                       | Clifton Park NY 12065, USA
>> 
>> _______________________________________________
>> 
>> Powered by www.kitware.com
>> 
>> 
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> 
>> 
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>> 
>> 
>> 
>> Follow this link to subscribe/unsubscribe:
>> 
>> http://www.vtk.org/mailman/listinfo/vtkusers
>> 
>> 
> 
> 
> --
> François Bertel, PhD  | Kitware Inc. Suite 204
> 1 (518) 371 3971 x113 | 28 Corporate Drive
>                      | Clifton Park NY 12065, USA
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK 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