Issue Details (XML | Word | Printable)

Key: JAVA3D-361
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: java3d-issues
Reporter: eknah
Votes: 3
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
java3d

java3d crashes on cloned double head screens

Created: 06/Oct/06 02:00 AM   Updated: 29/Aug/08 10:25 AM
Component/s: j3d-core
Affects Version/s: 1.4.0
Fix Version/s: 1.6.0

Time Tracking:
Not Specified

Environment:

Operating System: Linux
Platform: PC


Issuezilla Id: 361
Tags:
Participants: aces, eknah, java3d-issues, kcr and matteodg


 Description  « Hide

Trying to run a program which heavily uses java3d on a laptop where I use the
build-in panel together with an external flat screen. The Xorg configuration is
"multihead cloned". So even if java sees two graphics devices, there is in fact
only one. The error thrown is:

Exception:
java.lang.IllegalArgumentException: adding a container to a container on
a different GraphicsDevice

Graphics devices:
[1] id: :0.0
[1] mem: -1.0E-6
[1] size: 1280x800
[1] bit depth: -1
[1] refresh rate: 0
[2] id: :0.1
[2] mem: -1.0E-6
[2] size: 1280x800
[2] bit depth: -1
[2] refresh rate: 0

Note that, logically, these devices are completely identical!

This setup is essential for presentation purposes (one screen replaced by a
beamer), so I need urgent help.



kcr added a comment - 11/Oct/06 12:50 PM

I doubt that we will be able to do anything about this for 1.5.0, especially
since the exception is coming from AWT and not from Java 3D.

Set target milestone to 1.6.0, since this isn't a regression and isn't a primary
configuration.


matteodg added a comment - 19/Feb/08 04:24 AM

I'm having the same exception using a dual monitor environment under Windows XP.
But the problem seems to be a bit random, because when I move the window with
the Canvas3D from one monitor to another sometimes the problem disappears and
sometimes comes back...
For example the first time I open the window the canvas is gray (as the
background of the window), but if I move in the other monitor it becomes black
showing the 3D scene in the right way. If I move again the window in the first
monitor the canvas keeps the 3D scene, but every mouse movement for rotating the
scene does not work...
It happens also with the Java Web start examples, not only with my own code...

Here is the stack trace:
java.lang.IllegalArgumentException: adding a container to a container on a
different GraphicsDevice
at java.awt.Component.checkGD(Unknown Source)
at java.awt.Container.checkGD(Unknown Source)
at java.awt.Container.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at
org.netbeans.swing.tabcontrol.plaf.StackLayout.showComponent(StackLayout.java:75)
at
org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI.showComponent(DefaultTabbedContainerUI.java:564)
at
org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI$NoOpFxProvider.doFinish(DefaultTabbedContainerUI.java:1358)
at org.netbeans.swing.tabcontrol.plaf.FxProvider.finish(FxProvider.java:102)
at
org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI$NoOpFxProvider.doStart(DefaultTabbedContainerUI.java:1363)
at org.netbeans.swing.tabcontrol.plaf.FxProvider.start(FxProvider.java:85)
at
org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI.showComponentWithFxProvider(DefaultTabbedContainerUI.java:593)
at
org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI$SelectionListener.stateChanged(DefaultTabbedContainerUI.java:1060)
[catch] at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123)
at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109)
at
org.netbeans.swing.tabcontrol.plaf.DefaultTabSelectionModel.indicesChanged(DefaultTabSelectionModel.java:273)
at
org.netbeans.swing.tabcontrol.DefaultTabDataModel.fireIndicesChanged(DefaultTabDataModel.java:492)
at
org.netbeans.swing.tabcontrol.DefaultTabDataModel.setTabs(DefaultTabDataModel.java:120)
at
org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter.setTopComponents(TabbedAdapter.java:234)
at
org.netbeans.core.windows.view.ui.TabbedHandler.setTopComponents(TabbedHandler.java:156)
at
org.netbeans.core.windows.view.ui.AbstractModeContainer.setTopComponents(AbstractModeContainer.java:124)
at
org.netbeans.core.windows.view.ModeView.setTopComponents(ModeView.java:137)
at
org.netbeans.core.windows.view.ViewHierarchy.updateViewForAccessor(ViewHierarchy.java:254)
at
org.netbeans.core.windows.view.ViewHierarchy.updateViewForAccessor(ViewHierarchy.java:241)
at
org.netbeans.core.windows.view.ViewHierarchy.updateViewForAccessor(ViewHierarchy.java:226)
at
org.netbeans.core.windows.view.ViewHierarchy.updateViewHierarchy(ViewHierarchy.java:143)
at
org.netbeans.core.windows.view.DefaultView.changeGUI(DefaultView.java:149)
at
org.netbeans.core.windows.ViewRequestor.dispatchRequest(ViewRequestor.java:269)
at
org.netbeans.core.windows.ViewRequestor.processRequest(ViewRequestor.java:245)
at
org.netbeans.core.windows.ViewRequestor.postRequest(ViewRequestor.java:183)
at
org.netbeans.core.windows.ViewRequestor.scheduleRequest(ViewRequestor.java:123)
at
org.netbeans.core.windows.Central.addModeOpenedTopComponent(Central.java:747)
at
org.netbeans.core.windows.ModeImpl.addOpenedTopComponent(ModeImpl.java:303)
at
org.netbeans.core.windows.WindowManagerImpl.topComponentOpenAtTabPosition(WindowManagerImpl.java:1072)
at
org.netbeans.core.windows.WindowManagerImpl.topComponentOpen(WindowManagerImpl.java:1040)
at org.openide.windows.TopComponent.open(TopComponent.java:382)
at org.openide.windows.TopComponent.open(TopComponent.java:373)
at com.streamsim.view3d.actions.c.run(SourceFile:148)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


aces added a comment - 19/Feb/08 08:01 AM

BUT I have the following problem when I run start applets on second screen, and
I guess they are related :

java.lang.IllegalArgumentException: adding a container to a container on a
different GraphicsDevice
at java.awt.Component.checkGD(Unknown Source)
at java.awt.Container.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at
org.jdesktop.j3d.examples.four_by_four.FourByFour.init(FourByFour.java:314)
at
org.jdesktop.applet.util.JNLPAppletLauncher.startSubApplet(JNLPAppletLauncher.java:1904)
at
org.jdesktop.applet.util.JNLPAppletLauncher.access$200(JNLPAppletLauncher.java:658)
at
org.jdesktop.applet.util.JNLPAppletLauncher$5.run(JNLPAppletLauncher.java:1269)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Moving browser to second screen and reloading the page is enough to get the
applet running.

I´m going to change my applets to use something like below:
(in fact, this is a modified SimpleUniverse.getPreferredConfiguration() )

/**

  • Finds the preferred <code>GraphicsConfiguration</code> object
  • for the system. This object can then be used to create the
  • Canvas3D objet for this system. <br>
  • This method targets multiscreen systems, where Canvas3D is
  • placed in other Screen then DefaultScreen device.
    *
  • @param comp - Component which will hold-on a Canvas3D. If null or
  • not yet added to a container, this will fall back to
  • SimpleUniverse.getPreferredConfiguration. This can be instances of
  • Applets, Window, Frame, JFrame or JPanel already attached to one
  • of previous Containers.
  • @return The best <code>GraphicsConfiguration</code> object for
  • the GraphicsDevice where compis shown.
  • @see
    */
    public static java.awt.GraphicsConfiguration
    getPreferredConfiguration(java.awt.Component comp) {

javax.media.j3d.GraphicsConfigTemplate3D template =
new javax.media.j3d.GraphicsConfigTemplate3D();
String stereo;

// Check if the user has set the Java 3D stereo option.
// Getting the system properties causes appletviewer to fail with a
// security exception without a try/catch.

stereo = (String) java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() { return System.getProperty("j3d.stereo"); }
});

// update template based on properties.
if (stereo != null) { if (stereo.equals("REQUIRED")) template.setStereo(template.REQUIRED); else if (stereo.equals("PREFERRED")) template.setStereo(template.PREFERRED); }

if(comp !=null) {
java.awt.GraphicsConfiguration gc = comp.getGraphicsConfiguration();
if(gc!=null) { java.awt.GraphicsDevice device = gc.getDevice(); return device.getBestConfiguration(template); }
}
return
com.sun.j3d.utils.universe.SimpleUniverse.getPreferredConfiguration();
}
/*****************/

I hope it helps as workaround.


matteodg added a comment - 19/Feb/08 08:29 AM

Great, that helps a lot!
I ask to my main JFrame the device in which it resides (in which it was created
by default) with frame.getGraphicsConfiguration().getDevice() and then I use
that device to get the right GraphicsConfiguration for creating a Canvas3D.
Then when I move the Canvas3D from one screen to another, I do not get that
exception anymore.

Thanks aces!


aces added a comment - 29/Aug/08 10:25 AM

Hi

The root of this issue is the correct creation of Canvas3D for multi-screen
devices. Canvas 3D documentation must be updated, showing how to create Canvas
3D in above situations.