Total members 11892 |It is currently Sat Sep 21, 2024 9:34 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Hai,

I am new to this forum. I am developing my first application in J2ME of handling m3g files which includes Loading of Model,Loading of Texture, Rotate Right, Rotate Left, Zoom in and Zoom Out.

Now loading of m3g image is done. Texture Loading is not happening.

I am loading car model as m3g file. For the same car the texture is not loading which is in Jpg or png formats.

Can you guide me how to load the texture.

The code which I am trying is given below for loading of model and texture.
java code
// 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);


What is happening with the above code is model is loading properly and able to rotate and zoom but the texture is not at all loading.

Then I interacted with the Graphics Team and finally they have given me m3g format file only which consists of its own textures as inbuilt. In this case what is happening is, the model is loading properly with the textures. But I am unable to rotate or zoom the model. If I click for rotate or zoom the model is hiding out of the screen and unable to monitor the X,Y,Z co-ordinates and Camera position.

I have referred and used the code which is given in the following link :
Code:
http://www.j2meforums.com/forum/index.php?topic=21154.0


So, please suggest me which is the best way for handling m3g and if possible please give me source code.




Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Handling m3g format (3D files for mobiles) in J2ME
 PDF Format     -  
 Format Specifier in C     -  
 Number format for current     -  
 Format Debugging Messages     -  
 Number format function prototype     -  
 Printing today+ current date with different format     -  
 i want to draw a circle on a image(any format bmp,jpeg etc.)     -  
 database contents display in table format in swing     -  
 Exception handling     -  
 What is Event Handling?     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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