Total members 10261 | Gratitudes |It is currently Wed May 23, 2012 8:20 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Question
 Question subject: Handling m3g format (3D files for mobiles) in J2ME
PostPosted: Thu Oct 21, 2010 12:37 pm 
Offline
Newbie
User avatar

Joined: Thu Oct 21, 2010 7:16 am
Posts: 1
Has thanked: 0 time
Have thanks: 0 time

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.

// 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 :

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.

Thanks and Regards,
Manivannan.G


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  

 Similar topics
 Printing today+ current date with different format
 Uplading Files Dynamically Using SSIS
 script for including files
 Exception handling
 How to download and save .mov files from this website ?
 database contents display in table format in swing
 Event Handling Notes
 j2me
 How to read string text in files
 How to write a PHP coding to list out all files and director

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 8 guests



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team