1

I've installed VTK 8.2.0 with CMake for use with QT but when trying to run some VTK examples I have some issues shown below:

background issues

Note: The colour banding issues in the image is from the gif compression and is not part of the issue

#include <vtkSmartPointer.h>

#include <vtkActor.h>
#include <vtkCubeSource.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>

int main(int, char *[])
{
  // Create a cube.
  vtkSmartPointer<vtkCubeSource> cubeSource = 
    vtkSmartPointer<vtkCubeSource>::New();

  // Create a mapper and actor.
  vtkSmartPointer<vtkPolyDataMapper> mapper = 
    vtkSmartPointer<vtkPolyDataMapper>::New();
  mapper->SetInputConnection(cubeSource->GetOutputPort());

  vtkSmartPointer<vtkActor> actor = 
    vtkSmartPointer<vtkActor>::New();
  actor->SetMapper(mapper);

  // Create a renderer, render window, and interactor
  vtkSmartPointer<vtkRenderer> renderer = 
    vtkSmartPointer<vtkRenderer>::New();
  vtkSmartPointer<vtkRenderWindow> renderWindow = 
    vtkSmartPointer<vtkRenderWindow>::New();
  renderWindow->AddRenderer(renderer);
  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = 
    vtkSmartPointer<vtkRenderWindowInteractor>::New();
  renderWindowInteractor->SetRenderWindow(renderWindow);

  // Add the actors to the scene
  renderer->AddActor(actor);
  renderer->SetBackground(.3, .2, .1);

  // Render and interact
  renderWindow->Render();
  renderWindowInteractor->Start();

  return EXIT_SUCCESS;
}

https://vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Cube

For all of the examples, it appears that the previous frame is not being cleared and the background is not being shown over it.

I don't appear to get any error messages when compiling or running the program. Might it be a driver issue?

Any help would be much appreciated!

Alessi 42
  • 1,112
  • 11
  • 26
  • Have you built VTK from source? Have you tried on different systems? On what system are you working? Have you checked the OpenGL capabilities of your computer? There are plenty of possible reasons, which makes it a bit hard to help. – normanius Feb 13 '20 at 00:09
  • Do the [WebGL samples](https://webglsamples.org/) work flawlessly? Have you consulted [this resource](https://vtk.org/Wiki/VTK/OpenGL_Driver_Information)? In case you want to build VTK without OpenGL support, see [this thread](http://vtk.1045678.n5.nabble.com/Building-VTK-without-OpenGL-td5734487.html). – normanius Feb 13 '20 at 00:13

0 Answers0