java.lang.NoSuchMethodException: when exporting image
Posted: Tue 7. Aug 2012, 11:31
Using Apple.MacBookPro.OSX.SnowLeopard.Eclipse.Juno:
jreality 5494 [http:fs.math....]>->Replace With->Latest from repository
jreality>src-ui>de.jreality.ui.viewerapp>ViewerApp.java 5037>->Run As->1 Java Application
View->Show bean shell
[JRealityBeanShell]>self.setGeometry(Primitives.sphere(20))
File->Export->Image
Save as: junk123.png
throws exception with this output:
Junk123.png exists, but it is all black
I didn't check to see if adding lights, etc. would make it show up, but it seems the exception at least ought to be caught even if that's the case.
I tried stepping through the code and not sure why it thinks renderOffscreen isn't a method. It's in the SoftViewer class, and I can call it from my own code like this but get a gray image: Maybe someone more familiar with the code can take a look at ExportImage.java.
As I said, the ViewerApp generates a black image.
Here's a short snippet of code that generates a gray image that I made trying to isolate the problem...
This code doesn't throw any exceptions, but it generates a plain gray image (maybe transparent) with nothing on it though the blue sphere shows up on the JReality Viewer window. Perhaps I'm missing something. Nevertheless, the ExportImage seems broken in the latest from the repository as of tonight.
jreality 5494 [http:fs.math....]>->Replace With->Latest from repository
jreality>src-ui>de.jreality.ui.viewerapp>ViewerApp.java 5037>->Run As->1 Java Application
View->Show bean shell
[JRealityBeanShell]>self.setGeometry(Primitives.sphere(20))
File->Export->Image
Save as: junk123.png
throws exception with this output:
Code: Select all
Possibly no jogl libraries in java.library.path!
scene root is root
java.lang.NoSuchMethodException: <unbound>=SoftViewer.renderOffscreen(Integer, Integer, Double);
at java.beans.Statement.invokeInternal(Statement.java:260)
at java.beans.Statement.access$000(Statement.java:39)
at java.beans.Statement$2.run(Statement.java:140)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Statement.invoke(Statement.java:137)
at java.beans.Expression.getValue(Expression.java:98)
at de.jreality.ui.viewerapp.actions.file.ExportImage.actionPerformed(ExportImage.java:132)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
at com.apple.laf.AquaMenuItemUI.doClick(AquaMenuItemUI.java:137)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6375)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6140)
at java.awt.Container.processEvent(Container.java:2083)
at java.awt.Component.dispatchEventImpl(Component.java:4737)
at java.awt.Container.dispatchEventImpl(Container.java:2141)
at java.awt.Component.dispatchEvent(Component.java:4565)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4280)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
at java.awt.Container.dispatchEventImpl(Container.java:2127)
at java.awt.Window.dispatchEventImpl(Window.java:2482)
at java.awt.Component.dispatchEvent(Component.java:4565)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:684)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:643)
at java.awt.EventQueue$1.run(EventQueue.java:641)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:657)
at java.awt.EventQueue$2.run(EventQueue.java:655)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:654)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Wrote file /Users/ted/junk123.png
I didn't check to see if adding lights, etc. would make it show up, but it seems the exception at least ought to be caught even if that's the case.
I tried stepping through the code and not sure why it thinks renderOffscreen isn't a method. It's in the SoftViewer class, and I can call it from my own code like this but get a gray image: Maybe someone more familiar with the code can take a look at ExportImage.java.
As I said, the ViewerApp generates a black image.
Here's a short snippet of code that generates a gray image that I made trying to isolate the problem...
Code: Select all
public static void main(String[]unused) {
SoftViewer sv = new SoftViewer();
sv.setSceneRoot(Primitives.wireframeSphere());
BufferedImage bi;
bi = sv.renderOffscreen(1000, 1000);
JFrame jf1 = new JFrame();
jf1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf1.setVisible(true);
jf1.getContentPane().add(new JLabel(new ImageIcon(bi)));
jf1.pack();
}