1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 5 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 6 All rights reserved. 7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 8 9 This software is distributed WITHOUT ANY WARRANTY; without even 10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 11 PURPOSE. See the above copyright notice for more information. 12 13 =========================================================================*/ 14 15 #include "vtkActor.h" 16 #include "vtkNew.h" 17 #include "vtkPolyDataMapper.h" 18 #include "vtkRegressionTestImage.h" 19 #include "vtkRenderWindow.h" 20 #include "vtkRenderWindowInteractor.h" 21 #include "vtkRenderer.h" 22 #include "vtkSphereSource.h" 23 #include "vtkTestUtilities.h" 24 25 //---------------------------------------------------------------------------- 26 // Test one can create an resize offscreen render windows. TestOffscreenRenderingResize(int argc,char * argv[])27int TestOffscreenRenderingResize(int argc, char* argv[]) 28 { 29 vtkNew<vtkRenderWindow> window; 30 window->SetOffScreenRendering(1); 31 window->SetSize(300, 300); 32 33 vtkNew<vtkRenderWindowInteractor> iren; 34 iren->SetRenderWindow(window); 35 36 vtkNew<vtkRenderer> ren; 37 ren->SetBackground(0.3, 0.3, 0.3); 38 window->AddRenderer(ren); 39 40 vtkNew<vtkSphereSource> sphere; 41 vtkNew<vtkPolyDataMapper> mapper; 42 mapper->SetInputConnection(sphere->GetOutputPort(0)); 43 vtkNew<vtkActor> actor; 44 actor->SetMapper(mapper); 45 ren->AddActor(actor); 46 47 ren->ResetCamera(); 48 window->Render(); 49 50 window->SetSize(400, 300); 51 window->Render(); 52 int retVal = vtkRegressionTestImage(window); 53 if (retVal == vtkTesting::DO_INTERACTOR) 54 { 55 iren->Start(); 56 } 57 return !retVal; 58 } 59