6

I've been stuck on the same problem for some time and I don't know why I get the following Run-time error when I run my project.

Exception in thread "main" org.web3d.vrml.lang.UnsupportedNodeException: Request for a node that is not part of the specified profile and components for this stream: viewpoint
    at org.web3d.vrml.renderer.DefaultNodeFactory.createVRMLNode(DefaultNodeFactory.java:730)
    at org.web3d.vrml.renderer.ogl.OGLMainSceneBuilder.startNode(OGLMainSceneBuilder.java:147)
    at org.web3d.vrml.renderer.ogl.OGLVRMLSceneBuilder.startNode(OGLVRMLSceneBuilder.java:514)
    at org.web3d.x3d.jaxp.X3DSAVAdapter.startElement(X3DSAVAdapter.java:830)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1364)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at org.web3d.parser.GeneralisedReader.parse(GeneralisedReader.java:261)
    at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:156)
    at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:203)
    at org.web3d.vrml.scripting.browser.X3DCommonBrowser.createX3DFromURL(X3DCommonBrowser.java:264)
    at org.web3d.vrml.scripting.external.sai.SAIBrowser.createX3DFromURL(SAIBrowser.java:843)
    at xj3dtest.Xj3DTest.<init>(Xj3DTest.java:50)
    at xj3dtest.Xj3DTest.main(Xj3DTest.java:56)

My Java code for this is

package xj3dtest;

import java.awt.BorderLayout;
import java.awt.Container;
import static java.lang.Boolean.TRUE;
import javax.swing.JFrame;
import org.web3d.x3d.sai.Browser;
import org.web3d.x3d.sai.BrowserFactory;
import org.web3d.x3d.sai.X3DComponent;
import org.web3d.x3d.sai.X3DScene;
import java.util.HashMap;

public class Xj3DTest extends JFrame {

    public Xj3DTest(String title) {

        super(title);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Setup browser parameters
        HashMap requestedParameters=new HashMap();
        requestedParameters.put("Antialiased",TRUE);
        requestedParameters.put("TextureQuality","medium");
        requestedParameters.put("PrimitiveQuality","medium");
        requestedParameters.put("Xj3D_InterfaceType","SWING");
        requestedParameters.put("Xj3D_NavbarShown",TRUE);
        requestedParameters.put("Xj3D_NavbarPosition","TOP");
        requestedParameters.put("Xj3D_LocationShown",TRUE);
        requestedParameters.put("Xj3D_LocationPosition","TOP");
        requestedParameters.put("Xj3D_LocationReadOnly",TRUE);
        requestedParameters.put("Xj3D_ShowConsole",TRUE);
        requestedParameters.put("Xj3D_OpenButtonShown",TRUE);
        requestedParameters.put("Xj3D_ReloadButtonShown",TRUE);
        requestedParameters.put("Xj3D_StatusBarShown",TRUE);
        requestedParameters.put("Xj3D_FPSShown",TRUE);
        requestedParameters.put("Xj3D_ContentDirectory","CurrentDirectory");
        requestedParameters.put("Xj3D_AntialiasingQuality","low");
        requestedParameters.put("Xj3D_Culling_Mode", "frustum");

        System.setProperty("x3d.sai.factory.class", "org.xj3d.ui.awt.browser.ogl.X3DOGLBrowserFactoryImpl");
        X3DComponent x3dComponent = BrowserFactory.createX3DComponent(requestedParameters);

        Browser browser = x3dComponent.getBrowser();

        Container cp = getContentPane();
        cp.setLayout(new BorderLayout());
        cp.add((javax.swing.JPanel)x3dComponent, BorderLayout.CENTER);

        X3DScene scene = browser.createX3DFromURL(new String[] {"test.x3d"});

        browser.replaceWorld(scene);
    }

    public static void main(String[] args) {
        Xj3DTest frame = new Xj3DTest("Xj3D test");
        frame.setSize(640, 480);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

The X3D files that I need to pass through it so it displays contain a viewpoint and imageTexture url tags which are tested to cause the problem. When I delete those tags from within the X3D files, it does work but doesn't have the desired output as it seemed to be zoomed in and have no texture the the X3D file.

The Jars that I'm using are gluegen-rt, gluegen-rt-natives-linux-amd64, gluegen-rt-natives-windows-amd64, gluegen-rt-natives-linux-i586, j3d-core-1.3.1, jhall, joal, joal-natives-linux-amd64, joal-natives-windows-amd64, joal-natives-linux-i586, joal-all, joal-all-natives-linux-amd64, joal-all-natives-windows-amd64, joal-all-natives-linux-i586, xj3d.browser_2.1.0-nps, xj3d.cadfilter_2.1.0_nps, xj3d.2.1-3rdparty-nps, xj3d.2.1-nps, xj3d-core, xj3d-runtime, xj3d-script-base. The way that I've set the VM Options is by using -Xmx450M -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\jar" and I have added the library that contains all the Jars to the project.

EDIT It's still not working

EDIT#2

The two tags that are causing the problem are

<viewpoint centerOfRotation="7 1 0" position='10 0 40' orientation='0 0 0 1'></viewpoint>

<imageTexture url='"http://somewebsite.com/images/test.jpg"></imageTexture> Bare in mind that the above website isn't the website where the image is stored but it follows the same format.

EDIT #3

The code in the X3D file is now <viewpoint centerOfRotation="7 1 0" position='10 0 40' orientation='0 0 0 1'></viewpoint>

<imageTexture url="http://somewebsite.com/images/test.jpg"></imageTexture>

And I'm still getting the viewpoint error and I don't know how to fix it

smitthy
  • 307
  • 4
  • 18
  • Since it is a very specific issue, If I were you, I would specify clearly how to set up your environment? Where did you get the libraries? Which version do you use? ... – Nicolas Filotto Apr 15 '16 at 17:33
  • @NicolasFilotto I set up the environment by following the instructions provided by Xj3D. I created my own library called `Xj3D` which contains all the `Jars` that I need for it to run – smitthy Apr 17 '16 at 11:07
  • Normally caused by bad jar files. – I_am_Batman Apr 17 '16 at 18:26
  • @I_am_Batman How would I detect it if it was a bad jar? – smitthy Apr 18 '16 at 23:22
  • @I_am_Batman I've tried to redownload them and I'm still getting the error – smitthy Apr 20 '16 at 10:31
  • 1
    @smitty could you share "test.x3d" file or explicitly copy those tags from within the X3D that you know cause the problem – Franco Rondini Apr 20 '16 at 21:51
  • 1
    @smitthy I notice you have single and double quotes for parameters, with url='" (single+double) is it a typo or your actual code? – Preuk Apr 22 '16 at 12:00
  • @Preuk it's my actual code – smitthy Apr 22 '16 at 14:54
  • @smitthy then your XML is invalid, you should remove the extra single quote on url attribute definition – Preuk Apr 22 '16 at 15:03
  • @Preuk thanks, how would I get rid of the `viewpoint` bit of the error? – smitthy Apr 24 '16 at 13:44
  • @smitthy have you tried checking your XML against X3D schema? http://www.web3d.org/specifications/x3d-3.3.xsd ; you could also use consistent format for your attibutes (single vs. double quote), some parsers are not tolerant... – Preuk Apr 24 '16 at 21:32

1 Answers1

0

For the first tag, the error was obviously a bogus single quote on url attribute.

For the second one, you could try using consistent quotes for all of your attributes, some parsers happen to fail on this.

Globally, you could start there:

  • check well-formedness of your XML with tools like this validator
  • check that your X3D is valid against the xsd declared in your XML header. There are a few references for validators on this page, but the most efficient way is still using an XML authoring tool of your choice.
Preuk
  • 632
  • 7
  • 18