[vtkusers] Using VTK with Java on Mac OS X
Robert.Nelson at tessella.com
Robert.Nelson at tessella.com
Fri Feb 20 09:02:33 EST 2004
Tessella Ref: NPD/3797/PR/TN/2004FEB20/14:02:32
Hi,
I've been trying to get Java/VTK to work under OSX. My question is should
it work and if so, what am I doing wrong?
I have OS X version 10.2.8 and Java v1.4.1_01-69.1
I had to perform the following hack (found in the mailing list archive) to
get the java bindings to build:
> in VTK/Common/vtkJavaAwt.h change lines 86 through 88 from:-
>
> JAWT_MacDrawingSurfaceInfo* dsi_mac;
> dsi_mac = (JAWT_MacDrawingSurfaceInfo*)dsi->platformInfo;
> temp0->SetWindowId((void *)dsi_mac->fQDWindow);
>
> to:-
>
> JAWT_MacOSXDrawingSurfaceInfo* dsi_mac;
> dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo;
> temp0->SetWindowId((void *)dsi_mac->cgWindowID);
I then have something which does not work. The program I want to run is
too large so I've created the following program which works on the PC -
you get a Cone which can be rotated with the mouse. Under CARBON I just
get a blank window. Under COCOA I get a bus error:
#0 0x90986b18 in glMatrixMode ()
#1 0x0668159c in vtkCocoaRenderWindow::OpenGLInit() ()
#2 0x06681bd0 in vtkCocoaRenderWindow::WindowInitialize() ()
#3 0x06680b38 in vtkCocoaRenderWindow::Start() ()
#4 0x066449ec in vtkRenderWindow::DoStereoRender() ()
#5 0x066449b0 in vtkRenderWindow::DoFDRender() ()
#6 0x066445c4 in vtkRenderWindow::DoAARender() ()
#7 0x06643dcc in vtkRenderWindow::Render() ()
...
The program is:
import java.awt.*;
import javax.swing.*;
public class ConeFrame extends JFrame {
public ConeFrame() { }
public static void main(String [] args) {
ConePanel panel= new ConePanel();
panel.drawMe();
JFrame frame= new ConeFrame();
frame.getContentPane().add(panel);
frame.setSize(600,600);
frame.show();
}
}
and:
import vtk.*;
import java.awt.*;
public class ConePanel extends vtk.vtkPanel {
public ConePanel(){ }
public void drawMe () {
vtkConeSource cone = new vtkConeSource();
cone.SetHeight( 3.0 );
cone.SetRadius( 1.0 );
cone.SetResolution( 10 );
vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();
coneMapper.SetInput( cone.GetOutput() );
vtkActor coneActor = new vtkActor();
coneActor.SetMapper( coneMapper );
vtkRenderer ren1 = GetRenderer(); //new vtkRenderer();
ren1.AddActor( coneActor );
ren1.SetBackground( 0.1, 0.2, 0.4 );
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
}
}
Has anyone managed to do this in Java on the Mac and if so how?
Thanks for your help,
Rob
This message is confidential and may be privileged. It is intended for the
addressee(s) only. Access to this message by anyone else is unauthorized
and strictly prohibited. If you have received this message in error,
please inform the sender immediately. Please note that messages sent or
received by the Tessella e-mail system may be monitored and stored in an
information retrieval system.
TESSELLA Robert.Nelson at tessella.com
__/__/__/ Tessella Support Services plc
__/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England
__/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301
www.tessella.com Registered in England No. 1466429
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040220/55767057/attachment.htm>
More information about the vtkusers
mailing list