@@ -0,0 +1,3135 @@
+import vtk.vtkActor;%0Aimport vtk.vtkNamedColors;%0Aimport vtk.vtkNativeLibrary;%0Aimport vtk.vtkPolyDataMapper;%0Aimport vtk.vtkRenderWindow;%0Aimport vtk.vtkRenderWindowInteractor;%0Aimport vtk.vtkRenderer;%0Aimport vtk.vtkTexturedSphereSource;%0Aimport vtk.vtkImageReader2Factory;%0Aimport vtk.vtkTexture;%0Aimport vtk.vtkImageReader2;%0Aimport vtk.vtkTransformTextureCoords;%0A%0Apublic class TexturedSphere %0A%7B%0A  // -----------------------------------------------------------------%0A  // Load VTK library and print which library was not properly loaded%0A  static %0A  %7B%0A    if (!vtkNativeLibrary.LoadAllNativeLibraries()) %0A    %7B%0A      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) %0A      %7B%0A        if (!lib.IsLoaded()) %0A        %7B%0A          System.out.println(lib.GetLibraryName() + %22 not loaded%22);%0A        %7D%0A      %7D%0A    %7D%0A    vtkNativeLibrary.DisableOutputWindow(null);%0A  %7D%0A  // -----------------------------------------------------------------%0A%0A  public static void main(String args%5B%5D) %0A  %7B%0A    //parse command line arguments%0A    if (args.length %3C 2) %0A    %7B%0A      System.err.println(%22Usage: java -classpath ... Filename(.png) translate e.g earthTexture.png 0 %22);%0A      return;%0A    %7D%0A    double translate%5B%5D = new double%5B3%5D;%0A    String inputFilename = args%5B0%5D;%0A    %0A    if (args.length %3E 2)%0A    %7B%0A    %09translate%5B0%5D = Double.parseDouble(args%5B1%5D);%0A    %7D%0A    else %0A    %7B%0A    %09translate%5B0%5D = 0.0;%0A    %7D%0A    translate%5B1%5D = 0.0;%0A    translate%5B2%5D = 0.0;%0A    %0A    System.out.print(translate%5B0%5D + %22 %22 + translate%5B1%5D + %22 %22 + translate%5B2%5D + %22%5Cn%22);%0A    %0A    vtkNamedColors colors = new vtkNamedColors();%0A%0A    double Bgcolor%5B%5D = new double%5B4%5D;%0A%0A    colors.GetColor(%22SteelBlue%22, Bgcolor);%0A    %0A    // Create a sphere with texture coordinates%0A    vtkTexturedSphereSource source = new vtkTexturedSphereSource();%0A    source.SetPhiResolution(40);%0A    source.SetThetaResolution(40);%0A%0A    // Read texture file%0A    vtkImageReader2Factory readerFactory = new vtkImageReader2Factory();%0A    vtkImageReader2 imageReader = new vtkImageReader2();%0A    imageReader = readerFactory.CreateImageReader2(inputFilename);%0A    imageReader.SetFileName(inputFilename);%0A    %0A    // Create texture%0A    vtkTexture texture = new vtkTexture();%0A    texture.SetInputConnection(imageReader.GetOutputPort());%0A%0A    vtkTransformTextureCoords transformTexture = new vtkTransformTextureCoords();%0A    transformTexture.SetInputConnection(source.GetOutputPort());%0A    transformTexture.SetPosition(translate);%0A%0A    vtkPolyDataMapper mapper = new vtkPolyDataMapper();%0A    mapper.SetInputConnection(transformTexture.GetOutputPort());%0A    %0A    vtkActor actor = new vtkActor();%0A    actor.SetMapper(mapper);%0A    actor.SetTexture(texture);%0A%0A    // Create the renderer, render window and interactor.%0A    vtkRenderer ren = new vtkRenderer();%0A    vtkRenderWindow renWin = new vtkRenderWindow();%0A    renWin.AddRenderer(ren);%0A    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();%0A    iren.SetRenderWindow(renWin);%0A    %0A    // Visualize%0A    ren.AddActor(actor);%0A%09%0A    ren.SetBackground(Bgcolor);%0A    %0A    renWin.SetSize(300, 300);%0A    renWin.Render();%0A    %0A    iren.Initialize();%0A    iren.Start();%0A  %7D%0A%7D%0A

Create TexturedSphere.java