vtk + java problem
    Sean Spicer 
    spicer at bme.stanford.edu
       
    Tue Apr 18 19:10:53 EDT 2000
    
    
  
All,
I'm experiencing some odd behavior using vtk with java2 (1.2.2) on sgi's.
Here's the deal: 
I add a vtkPanel to a JFrame window, and try and render a cone inside
it.  The following code illustrates this:
=========================================================================
import vtk.*;
import java.awt.*;
import javax.swing.*;
import java.io.InputStream;
public class javatest
{
  vtkPanel panel;
  Container container;
  int x, y;
  
  JFrame window;
  Container content;
  private static javatest theapp;
  public static void main(String[] args)
  {
    
    theapp = new javatest();
    theapp.init();
  }
  
  public void init()
  {
    Font myFont = new Font("serif", Font.BOLD, 12);
    window = new JFrame();
    window.setTitle("Javatest");
    window.setBounds(50, 100, 400, 150);
    window.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    window.setFont(myFont);
    
    content = window.getContentPane();
    panel = new vtkPanel();
   
    vtkConeSource cone = new vtkConeSource();
    cone.SetResolution(8);
    
    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();
    coneMapper.SetInput(cone.GetOutput());
    
    vtkActor coneActor = new vtkActor();
    coneActor.SetMapper(coneMapper);
    
    panel.getRenderer().AddActor(coneActor);
    // *** THIS CALL DOESN'T WORK *** //
    //System.out.println(panel.getWindowInfo());
    content.add(panel);
    window.setVisible(true);
    
    System.out.println("This is a vtk test");
  }
}
==================================================================
Here's what happens (all machines are are IRIX 6.5) 
SGI Octane MXI :  Everything works great, just what you'd expect.
SGI O2 : No vtkPanel is drawn.  can discern no visible rendering context.
SGI ONYX RE2 : The rendering context is allocated and displayed, but is
               not double-buffered, nor is a depth bit available.
The call vtkPanel.getWindowInfo fails on all platforms.
also, everything works great if I create a vtkRenderWindowInteractor, and
make the following call:
iren.SetRenderWindow(panel.getRenderWindow());
A separate render window is created (apart from the JFrame) and the
rendering is all handled in there!  (not the JFrame, which remains blank).
What's happening?  Is there a work around?
sean
___________________________________________________________________________
Sean Spicer                       Stanford University Medical Center  
Biomechanical Engineering         Division of Vascular Surgery, Suite H3642
Cardiovascular Biomechanics Lab   Stanford CA, 94305 
                                  Telephone...650.723.1695
                                  Fax.........650.723.8762
             http://solvedeath.stanford.edu/~spicer
 
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------
    
    
More information about the vtkusers
mailing list