Commit 9bfa3db7 authored by David Doria's avatar David Doria
Browse files

ENH: added test for OpenGLPolyDataMapper

parent 3e905ebc
......@@ -40,6 +40,7 @@ IF(VTK_USE_DISPLAY)
TestManyActors.cxx
TestOrderedTriangulator.cxx
TestOpacity.cxx
TestOpenGLPolyDataMapper.cxx
TestOSConeCxx.cxx
TestPOVExporter.cxx
TestResetCameraVerticalAspectRatio.cxx
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestOpenGLPolyDataMapper.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME Test of vtkLabelPlacementMapper
// .SECTION Description
// this program tests vtkLabelPlacementMapper which uses a sophisticated algorithm to
// prune labels/icons preventing them from overlapping.
#include <vtkSphereSource.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkOpenGLPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkTestUtilities.h>
#include <vtkRegressionTestImage.h>
int TestOpenGLPolyDataMapper(int argc, char *argv[])
{
//Create a sphere
vtkSmartPointer<vtkSphereSource> sphereSource =
vtkSmartPointer<vtkSphereSource>::New();
sphereSource->SetCenter(0.0, 0.0, 0.0);
sphereSource->SetRadius(5.0);
//Create a mapper and actor
vtkSmartPointer<vtkOpenGLPolyDataMapper> mapper =
vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();
mapper->SetInputConnection(sphereSource->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> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);
//Add the actor to the scene
renderer->AddActor(actor);
renderer->SetBackground(.3, .6, .3); // Background color green
//Render and interact
renderWindow->Render();
int retVal = vtkRegressionTestImage(renderWindow);
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
interactor->Start();
}
return !retVal;
return EXIT_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment