Java3D Loader Help: Getting Started

  • Java
  • Thread starter the other guy
  • Start date
In summary, the author is struggling with a problem where he does not know where to put the loader to use with Java3D. He has looked online, but does not find an answer. He asks for help from the internet, but does not provide enough information.
  • #1
the other guy
19
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
  • #2
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?
 
  • #3
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. }
 

Related to Java3D Loader Help: Getting Started

1. What is Java3D Loader?

Java3D Loader is a Java library that allows users to load and display 3D models in their Java applications. It provides a convenient and efficient way to incorporate 3D graphics into your projects.

2. How do I get started with Java3D Loader?

To get started with Java3D Loader, you can download the library from its official website and add it to your Java project's classpath. You can then use the provided classes and methods to load and display 3D models in your application.

3. What file formats does Java3D Loader support?

Java3D Loader supports a variety of 3D file formats, including OBJ, STL, PLY, and 3DS. You can check the documentation for a complete list of supported formats.

4. Can I customize the appearance of my 3D models with Java3D Loader?

Yes, Java3D Loader allows you to customize the appearance of your 3D models by applying textures, colors, and other visual effects. You can also manipulate the lighting and camera settings to further enhance the appearance of your models.

5. Is Java3D Loader suitable for all types of Java applications?

Java3D Loader is suitable for most types of Java applications, including desktop, web, and mobile applications. However, it requires a graphics card that supports OpenGL for optimal performance.

Similar threads

  • Programming and Computer Science
Replies
5
Views
10K
  • Programming and Computer Science
Replies
7
Views
3K
  • Programming and Computer Science
Replies
2
Views
3K
  • Sticky
  • Programming and Computer Science
Replies
13
Views
4K
  • Programming and Computer Science
Replies
6
Views
4K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
7
Views
3K
Back
Top