Java Java3D Loader Help: Getting Started

  • Thread starter Thread starter the other guy
  • Start date Start date
Click For Summary
The discussion centers on a user seeking assistance with using the MS3DLoader in Java3D after successfully downloading the necessary components, including the JDK. The user expresses frustration over not knowing how to implement the loader in their code, feeling lost without clear instructions. A suggestion is made to refer to a provided link that includes a sample file, Viewer.java, which contains a main method for initializing the modeler. Additionally, the user is encouraged to explore Sun's Java3D tutorials for further guidance, specifically pointing out relevant example code that demonstrates how to load models using ObjectFile, which may help clarify the steps needed to utilize the MS3DLoader effectively.
the other guy
Messages
19
Reaction score
0
May I begin with the fact that this entire situation is suffering from a serious "where's the 'readme' file" complex

Ok, so I'm a seasoned 3d modeler trying to learn Java3d. I have java3d, the complimentary JDK, and this loader
http://www.duling.us/kevin/Java3D/Milkshape/index.html

Problem is, I don't know what to do with the loader. Everywhere I look on the internet just says to type in the appropriate code, and I do, but the thing is I can't find where I'm supposed to put the Loader.

I'm missing a step, and I can't find it via online search. The step between downloading the Loader, and inserting the appropriate code. Here is the sample code. It doesn't do anything, but it should work as far as the use of the Loader. What do I do wiht this MS3DLoader?

sorry for asking, but I totally seem to have either described my problem so poorly the internet can't help me- or ...i dunno, maybe I am depressed. the days are longer, ...i dunno.

import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.BranchGroup;
import com.sun.j3d.loaders.*;
import com.glyphein.j3d.loaders.milkshape.MS3DLoader;
public class core {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}

}
 
Last edited by a moderator:
Technology news on Phys.org
Maybe I misunderstand what your problem is, but on the page you refer to there is a link to a file Viewer.java containing a main method that takes the model filename as parameter and then seems to initialize the modeler. Have you tried that?
 
I'm also learning Java3D; however I haven't learned enough to implement a loader quite yet either. I assume you have looked at Sun's tutorials online but if not, I hope this helps: http://java.sun.com/developer/onlineTraining/java3d/j3d_tutorial_ch3.pdf. I believe your answer may be on p. 3-3 within example code line 21.

Code:
1. import com.sun.j3d.loaders.objectfile.ObjectFile; 
2. import com.sun.j3d.loaders.ParsingErrorException; 
3. import com.sun.j3d.loaders.IncorrectFormatException; 
4. import com.sun.j3d.loaders.Scene; 
5. import java.applet.Applet;
6. import javax.media.j3d.*;
7. import javax.vecmath.*;
8. import java.io.*; 
9.
10. public class ObjLoad extends Applet {
11.
12. private String filename = null;
13.
14. public BranchGroup createSceneGraph() {
15. // Create the root of the branch graph
16. BranchGroup objRoot = new BranchGroup();
17.
18. ObjectFile f = new ObjectFile();
19.  Scene s = null;
20.  try {
21. s = f.load(filename);
22. }
23. catch (FileNotFoundException e) {
24. System.err.println(e);
25. System.exit(1);
26. }
27. catch (ParsingErrorException e) {
28. System.err.println(e);
29. System.exit(1);
30. }
31. catch (IncorrectFormatException e) {
32. System.err.println(e);
33. System.exit(1);
34. }
35.
36. objRoot.addChild(s.getSceneGroup());
37. }
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
5
Views
15K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K