[vtkusers] VTK 6 + Qt 5 -- 3D widgets are partially transparent. Why?

alketi rc5 at verizon.net
Fri Mar 7 15:08:03 EST 2014


I'm hoping this is an easy fix --

I've compiled VTK 6.1.0 against a custom Qt 5 installation and am using the
example code found on the VTK Wiki and putting it inside of a Qt
application.  

The problem is that the 3D widgets are exhibiting opacity issues.  Instead
of being solid objects, they're partially transparent.

This same code worked fine with VTK 5.10 & Qt 4.  Now with VTK 6 and Qt 5 I
have a problem with transparency/opacity.

Did something in the API change between VTK 5 & 6 that could cause this? 
Or, will this problem appear if VTK isn't compiled correctly?

Code and screenshot showing the issue are below:

/*
 * vtk_square.cpp
 */
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL);
VTK_MODULE_INIT(vtkRenderingOpenGL);
VTK_MODULE_INIT(vtkInteractionStyle);

#include "vtk_cube.h"

#include <vtkDataObjectToTable.h>
#include <vtkElevationFilter.h>
#include <vtkPolyDataMapper.h>
#include <vtkQtTableView.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkSphereSource.h>
#include <vtkCubeSource.h>
#include <vtkSmartPointer.h>
#include <QVTKWidget.h>

// Constructor
VtkCube::VtkCube(QVTKWidget *widget)
{
	// Cube
	vtkSmartPointer<vtkCubeSource> cubeSource =
			vtkSmartPointer<vtkCubeSource>::New();
	cubeSource->Update();
	vtkSmartPointer<vtkPolyDataMapper> cubeMapper =
			vtkSmartPointer<vtkPolyDataMapper>::New();
	cubeMapper->SetInputConnection(cubeSource->GetOutputPort());
	vtkSmartPointer<vtkActor> cubeActor =
			vtkSmartPointer<vtkActor>::New();
	cubeActor->SetMapper(cubeMapper);

	// VTK Renderer
	vtkSmartPointer<vtkRenderer> rightRenderer =
			vtkSmartPointer<vtkRenderer>::New();

	// Add Actor to renderer
	rightRenderer->AddActor(cubeActor);

	// VTK/Qt wedded
	widget->GetRenderWindow()->AddRenderer(rightRenderer);

	// Set up action signals and slots
}

In the screenshot, the word "Resolution" should be behind the sphere.  And,
obviously, the cube is showing its transparency.
<http://vtk.1045678.n5.nabble.com/file/n5726228/vtk_transparent.png> 



--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-6-Qt-5-3D-widgets-are-partially-transparent-Why-tp5726228.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list