Thu Oct 21, 2010 12:37 pm
// loading of model
G3D = Graphics3D.getInstance();
world = (World)Loader.load("/Swift/car.m3g")[0];
Object3D root[];
root=Loader.load(name);
world = (World) root[0];
mesh=(Mesh)world.find(4);
// loading of Texture
try
{
Image2D image2D = (Image2D) (Loader.load("/Swift/car_256.jpg")[0]);
//Image2D image2D = (Image2D) (Loader.load("/Swift/car_256.png")[0]);
Texture2D myTexture = new Texture2D(image2D);
myTexture.setFiltering(Texture2D.FILTER_NEAREST,Texture2D.FILTER_NEAREST);
myTexture.setWrapping(Texture2D.WRAP_CLAMP,Texture2D.WRAP_CLAMP);
myTexture.setBlending(Texture2D.FUNC_DECAL);
Appearance myAppearance = mesh.getAppearance(0);
myAppearance.setTexture(0, myTexture);
// myAppearance.setMaterial(iMaterial);
// iMaterial.setColor(Material.DIFFUSE, 0xFFFFFFFF); // white
//iMaterial.setColor(Material.SPECULAR, 0xFFFFFFFF); // white
//iMaterial.setShininess(100.0f);
} catch (Exception e) {
System.out.println("Error loading image " + "textureFile");
e.printStackTrace();
}
camera = world.getActiveCamera();
//camera.setScale((float)a, (float)b, (float)c);
camera.setScale(a,b,c);
http://www.j2meforums.com/forum/index.php?topic=21154.0
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.