This is what I use to load VRML files:
//--------------------------------------------------------------------
String filename = "file.wrl";
VrmlLoader newvrml = new VrmlLoader();
BranchGroup _newBG;
TransformGroup[] _viewTGs;
try {
// Load actual VRML model
_newBG = newvrml.load(filename).getSceneGroup();
// Load any View TransformGroups attached to this model
_viewTGs = newvrml.load(filename).getViewGroups();
} catch ( java.io.FileNotFoundException e ) {
// nothing
return;
}
// Add the VRML file to my scene's TransformGroup
objgrp.addChild(_newBG);
//--------------------------------------------------------------------
I don't set the appearance or geometry...maybe that is your error.
Mario
Mariusz Zaczek
NASA - Johnson Space Center
Automated Vehicles and Orbit Analysis / DM35
Flight Design and Dynamics Division
Mission Operations Directorate
Bldg: 30A Room: 3040A
Disclaimer: "The opinions, observations and comments expressed in my email
are strictly my own and do not necessarily reflect those of
NASA."
-----Original Message-----
From: Anissa [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 3:50 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] load vrml file in java3d
Hello,
i'm new to java 3d and i would like to know how can i load a vrml file
into a scene object.(i'm using vrml files to construct NURBS,that to my
knowledge are not directly supported by j3d)i've already downloaded
vrml97.jar and put it in: C:\jdk1.3.1_01\jre\lib\ext and i'm using this
code:
VrmlLoader f = new VrmlLoader();
try
{
s = f.load(filename);
}
//catch part
BranchGroup b = s.getSceneGroup();
Appearance ap = createAppearance();
s3 = (Shape3D) b.getChild(0);
g[0] = (GeometryArray) s3.getGeometry();
s3.setGeometry(g[0]);
s3.setAppearance(ap);
but it does not seem
to work, i'll be extremly thankful for your help.
sincerly
--
Anissa
****************************************************************************
**********************
The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager by
sending
an email to ITS Helpdesk at [EMAIL PROTECTED] or the sender
immediately
and do not disclose the contents to anyone or make copies.
ITS antivirus gateway has scanned this email for viruses, vandals and
malicious
content.
****************************************************************************
**********************
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".