Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Textures dont show up on models  (Read 1151 times)
0 Members and 1 Guest are viewing this topic.
Offline Soljaragz

Junior Devvie





« Posted 2006-03-27 02:01:33 »

I made a gun model with Milkshape, and when i imported it, it kind of showed up, but  it was completely black, even though i had textured it, then I tried a model i downloaded and it worked fine, so whats the deal?
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2006-03-27 02:21:28 »

A few things to check:

(1) Does your loader egenrate normals or does it assume you have set them?  if the latter are your normals set proiperly?

(2) Does your loader expect you to have set a material in your modeler?  If so, did you?

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Soljaragz

Junior Devvie





« Reply #2 - Posted 2006-03-27 02:23:31 »

ok I realized that in milkshape, you have to, when your done, regroup the entire model into one group,

I had it where i grouped it differently, to do textures (i.e. different colors for stuff), are I did this, the model imported with success.

ONLY problem is, and its a big problem, when I regrouped, all the texturing stuff got deleted, so do you know how to keep the textures?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Soljaragz

Junior Devvie





« Reply #3 - Posted 2006-03-27 03:05:06 »

Also another problem, I can run my program as a Application just fine, but when I try to open it as an applet in html, it has an error initializing

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.*;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.behaviors.vp.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.loaders.*;
import com.glyphein.j3d.loaders.milkshape.MS3DLoader;
public class LandTest extends Applet
{
   SimpleUniverse u;
   BoundingSphere bounds;
   ViewingPlatform ourView;
   OrbitBehavior B;
   
   public void init()
   {
      setLayout(new BorderLayout());
      GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
      Canvas3D c = new Canvas3D(config);
      u = new SimpleUniverse(c);
      BranchGroup scene = createSceneGraph();
      u.addBranchGraph(scene);
     
      ourView = u.getViewingPlatform();
      ourView.setNominalViewingTransform();
     
      B = new OrbitBehavior(c);
      B.setSchedulingBounds(bounds);
      ourView.setViewPlatformBehavior(B);
     
      add("Center",c);
   }

    public BranchGroup createSceneGraph()
    {
         BranchGroup objRoot = new BranchGroup();
      bounds = new BoundingSphere();
     
      String filePath="file://localhost/"+System.getProperty("user.dir")+"/";
      String texturePath=filePath + "stone.jpg";
     
     
      Land s = new Land(6, 6, texturePath);
     
     
     
      try
     
      {
         java.net.URL modelPath = new java.net.URL(filePath+"gun2.ms3d");
          Loader msLoader = new MS3DLoader();
          Scene ourScene;
         ourScene = msLoader.load(modelPath);
         BranchGroup modelBranch = ourScene.getSceneGroup();
         Shape3D model= (Shape3D)modelBranch.getChild(0);
         modelBranch.removeChild(0);
         
         /*Appearance modelapp = new Appearance();
         Color3f objColor = new Color3f(0.7f, 0.2f, 0.8f);
         Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
          modelapp.setMaterial(new Material(objColor, black, objColor, black, 80.0f));
          model.setAppearance(modelapp);*/

          objRoot.addChild(model);
      }
      catch(Exception e){
      }
     
      Color3f alColour = new Color3f(0.4f, 0.4f, 0.4f);
      AmbientLight aLgt = new AmbientLight(alColour);
      aLgt.setInfluencingBounds(bounds);
     
      Color3f DirColour = new Color3f(0.35f, 0.35f, 0.3f);
      Vector3f DirVec = new Vector3f(-0.5f, -0.2f, 0.6f);
      DirectionalLight DirLig = new DirectionalLight(DirColour, DirVec);
      DirLig.setInfluencingBounds(bounds);
     
     
      objRoot.addChild(DirLig);
      objRoot.addChild(aLgt);
      objRoot.addChild(s);
      objRoot.compile();
      return objRoot;
   }
   
    public static void main(String[] args) {
        new MainFrame(new LandTest(), 256, 256);
    }
}


error message:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
Java Plug-in 1.5.0_06
Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\peter


----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
p:   reload proxy configuration
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

java.lang.NoClassDefFoundError: javax/media/j3d/Bounds
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
   at java.lang.Class.getConstructor0(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at sun.applet.AppletPanel.createApplet(Unknown Source)
   at sun.plugin.AppletViewer.createApplet(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-4" java.lang.NullPointerException
   at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
   at sun.plugin.AppletViewer.showAppletException(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
   at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
   at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
java.lang.NoClassDefFoundError: javax/media/j3d/Bounds
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
   at java.lang.Class.getConstructor0(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at sun.applet.AppletPanel.createApplet(Unknown Source)
   at sun.plugin.AppletViewer.createApplet(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-8" java.lang.NullPointerException
   at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
   at sun.plugin.AppletViewer.showAppletException(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
   at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
   at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #4 - Posted 2006-03-28 21:06:45 »

It seems the errors point to a J3D installation issue (the applet classloader can't find J3D classes).

Yet, this line:
1  
String filePath="file://localhost/"+System.getProperty("user.dir")+"/";

also looks mighty suspicious (although the error would be a security exception, not a NoClassDefFoundError, taking the applet is unsigned)..

Offline Soljaragz

Junior Devvie





« Reply #5 - Posted 2006-03-29 00:51:04 »

well this is how i installed java3d

i put the contents t in my jdk_1.5.06, jre_1.05.06, and also my jdk_1.5.06/jre_1.5.06
Offline Jeff

JGO Coder




Got any cats?


« Reply #6 - Posted 2006-03-31 06:01:14 »

AIR you need to put the Java3D install into the jre dir within the JDK distriubtion...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (64 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!