[vtk-developers] thread Problem
Jeff Baumes
jeff.baumes at kitware.com
Wed Oct 24 08:55:18 EDT 2007
A few things that could help determine the problem: What OS and
version of VTK / Java are you using? Are you using vtkPanel? Can you
give a small example that fails?
The following code works in VTK CVS and Java 1.6 in Windows Vista.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import vtk.*;
public class SimpleVTK extends JPanel implements ActionListener {
static JFrame frame;
vtkPanel renWin;
JButton colorButton;
vtkActor coneActor;
public SimpleVTK() {
setLayout(new BorderLayout());
// Create the buttons.
renWin = new vtkPanel();
vtkConeSource cone = new vtkConeSource();
cone.SetResolution(8);
vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();
coneMapper.SetInput(cone.GetOutput());
coneActor = new vtkActor();
coneActor.SetMapper(coneMapper);
renWin.GetRenderer().AddActor(coneActor);
colorButton = new JButton("Change color");
colorButton.addActionListener(this);
add(renWin, BorderLayout.CENTER);
add(colorButton, BorderLayout.EAST);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource().equals(colorButton))
{
coneActor.GetProperty().SetColor(1.0, 0.0, 0.0);
renWin.GetRenderWindow().Render();
}
}
public static void main(String s[])
{
SimpleVTK panel = new SimpleVTK();
frame = new JFrame("SimpleVTK");
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e) {System.exit(0);}
});
frame.getContentPane().add("Center", panel);
frame.pack();
frame.setVisible(true);
}
}
On 10/22/07, hagbard23 <philipp.huebner at freenet.de> wrote:
>
> Hallo everybody....I think i have some kind of thread problem. When i want to
> change a prpperty of an actor i get this
> message:vtkWin32OpenGLRenderWindow.cxx, line 238vtkWin32OpenGLRenderWindow
> (1FE20E98): wglMakeCurrent failed in MakeCurrent(), error: The specified
> resource is yet in use. --> "Resource is in use".
>
> I use java and swt for my Gui. How can I reach this Objects?
> --
> View this message in context: http://www.nabble.com/thread-Problem-tf4672898.html#a13349969
> Sent from the VTK - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
--
Jeff Baumes, Ph.D.
R&D Engineer, Kitware Inc.
(518) 371-3971 x132
jeff.baumes at kitware.com
More information about the vtk-developers
mailing list