Create a simple box with a texture !!!

Hey guys !

I really dont know whats wrong with ME or with my code …but i cant manage it to add a simple box with a texture -.-

what is wrong here ? i mean…im new to java3d did i forget to add something or whats wrong? i think the important part begins in line 85

public class World  implements KeyListener   {
	
        JFrame frame = new JFrame();
	TransparencyAttributes objTransp;
	
	
	GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
	Canvas3D c = new Canvas3D(config);
	SimpleUniverse u = new SimpleUniverse(c);
	
	ObjectFile f = new ObjectFile(ObjectFile.RESIZE);
	Scene s = null;
	TransformGroup ViewTG = u.getViewingPlatform().getViewPlatformTransform();
	
	
	Transform3D ViewT3D = new Transform3D();
	
	  

	
	public World(){
		 
		 
         PhysicalEnvironment environment = u.getViewer().getPhysicalEnvironment();
         AudioDevice device = new JavaSoundMixer(environment);
         device.initialize();
         environment.setAudioDevice(device);
		 
        frame.add("Center",c);
        frame.addKeyListener(this);
	frame.setFocusable(true);
		
		OrbitBehavior ob = new OrbitBehavior(c);
	
		u.addBranchGraph(createSceneGraph());
		u.addBranchGraph(addObjects());
		u.getViewer().getView().setFrontClipDistance(0.001); 
		Light(u);
		
	
		try
		    {
		      s = f.load("Geist3.obj");
		    }
		    catch (Exception e)
		    {
		      System.out.println("File loading failed:" + e);
		    }
		
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(1600, 850);
		frame.setVisible(true);
		
		ob.setSchedulingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE));
		u.getViewingPlatform().setViewPlatformBehavior(ob);
	}
	
	
	public BranchGroup createSceneGraph(){
		
		
		 
	        BranchGroup RootBg = new BranchGroup();
		TransformGroup CastleTG = new TransformGroup();
		Transform3D CastleT3DX = new Transform3D();
		Transform3D CastleT3DY = new Transform3D();
		
		
		CastleT3DX.rotX((float)Math.toRadians(-90));
		CastleT3DY.rotZ((float)Math.toRadians(90));
		CastleT3DX.mul(CastleT3DY);
		CastleT3DX.setTranslation(new Vector3f(0.0f,0.0f,-6.0f)); 
		
		CastleTG.setTransform(CastleT3DX);
		
		
		try
	    {
	      s = f.load("Geist3.obj");
	    }
	    catch (Exception e)
	    {
	      System.out.println("File loading failed:" + e);
	    }
	// Here comes the important code fragment i think
		
               
	         TransformGroup tgground = new TransformGroup();
		Appearance abc = new Appearance();
		Texture txGround = new TextureLoader("gelb.jpg",frame).getTexture();  // maybe "frame" is wr0ng??
		abc.setTexture(txGround);
		
                Box w = new Box(10000,10000,10000,Box.GENERATE_NORMALS,abc);
		w.setAppearance(abc);
		tgground.addChild(w);
                RootBg.addChild(tgground);                 // here it ends

		

                 BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
		
		TextureLoader textureLoad = new TextureLoader("full.png",null);
		
		Background bgImage = new Background(textureLoad.getImage());
		   
		bgImage.setApplicationBounds(bounds);
		RootBg.addChild(bgImage);
		RootBg.addChild(m.playMusic());
		
		CastleTG.addChild(s.getSceneGroup()); 
	    RootBg.addChild(CastleTG);
	    RootBg.compile();
	    
	   
	    
	    return RootBg;
	}}
	

So whats wrong here ? is something missing ? did i add something wrong ? i dont get any errors !

please help me =(

thanks !!!

my bad, post removed

thank you very much but im not allowed to use other libraries :frowning: so has no one a solution for my little problem?

Try to add flag Box.GENERATE_TEXTURE_COORDS to Bpx ctor call.

When in doubt read a book, seriously don’t watch videos. They teach you what only what you see, not what you can do.

Hi

If you really want to obtain some help about Java3D, ensure that you use the very latest version (currently 1.6.0 pre 11) and post your question on its official forum. Stranger is problably right; if you don’t set any texture coordinates, you have to ask Java 3D to generate them. You can’t display a texture without texture coordinates.

DonDon’s answer is offtopic as the original poster is asking for help, not to switch to another library.

Sorry my post wasn’t helpful, I’m just a newbie too :-X I’ve deleted the post