zwei Texturen

igge81

Grünschnabel
hallo ,

ich würde gerne zwei Texturen auf eine Fläche setzen. Leider funktioniert das nicht! so wie ich es momentan versuche wird nur die letzte Textur dargestellt.
Vielleicht kann mir jemand helfen...danke

Code:
Appearance ap = new Appearance();
		
		TextureLoader[] textureLoad  = new TextureLoader[2];
	    textureLoad[0]  = new TextureLoader("door.jpg",null);
	    textureLoad[1] = new TextureLoader("window.jpg",null);
	    
	    for(int i = 0; i<2;i++)
	    {
	    	ImageComponent2D textureIm = textureLoad[i].getScaledImage(1024,1024);

	  	   
	   	  
	 	    Texture2D aTexture = new Texture2D(Texture.BASE_LEVEL,
	 	    								   Texture.RGB,
	                                           textureIm.getWidth(),
	                                           textureIm.getHeight());
		    aTexture.setImage(0,textureIm);
		    
		    Transform3D tfTail = new Transform3D();
		  
		    tfTail.rotZ(2*Math.PI);
		    tfTail.setScale(new Vector3d(0.1,0.1,0.1));
		    tfTail.setTranslation(new Vector3d(0.0,0.0,0));
		   
		    //Texturenattribute.
		    TextureAttributes texatt = new TextureAttributes(TextureAttributes.ALLOW_BLEND_COLOR_READ,
		    												 tfTail,
		    												 new Color4f(1.0f,1.0f,1.0f,1.0f),
		    												 TextureAttributes.NICEST);
		     
		    TexCoordGeneration tcg = new TexCoordGeneration(TexCoordGeneration.OBJECT_LINEAR
		    		,TexCoordGeneration.TEXTURE_COORDINATE_2
		    		,new Vector4f(0.0f, 0.0f, 1.0f, 0.0f)
		            ,new Vector4f(0.0f, 1.0f, 0.0f, 0.0f));
	
		    aTexture.setBoundaryModeS(Texture.CLAMP);
		    aTexture.setBoundaryModeT(Texture.CLAMP);
		    ap.setTextureAttributes(texatt);
		    ap.setTexCoordGeneration(tcg);
		    ap.setTexture(aTexture);
	    }
 
Zurück