www.jpct.net
jPCT - a 3d engine for Java => Support => Topic started by: Anonymous on May 04, 2004, 10:54:16 am
-
Hi all,
I've created a 3ds scene using Maya (and converted in a 3ds file as I've said in my previous thread); in the scene I've objs using materials with texture mapping and obj using materials without texture mapping.
I've tried to import this scene in a stand-alone context, such as fps, loading the textures like fps does:
File dir=new File("textures");
String[] files=dir.list();
for (int i=0; i<files.length; i++) {
String name=files;
if (name.endsWith(".jpg")) {
texMan.addTexture(name, new Texture ("textures"+File.separator+name));
}
}
and I've load my "level" like fps does:
Object3D[] levelParts=Loader.load3DS("3ds"+File.separator+"ThreeDSim.3ds", 20f);
level=new Object3D(0);
for (int i=0; i<levelParts.length; i++) {
Object3D part=levelParts;
.
.
.
everything goes fine. When I try to do the same thing in an applet context, so I load textures:
buffer=new FrameBuffer(width,height,FrameBuffer.SAMPLINGMODE_NORMAL);
theWorld=new World();
texMan=TextureManager.getInstance();
texMan.addTexture("car1",new Texture(getDocumentBase(),"textures/car1.jpg"));
.
.
.
load the "level":
Object3D[] levelParts=Loader.load3DS(getDocumentBase(),"3ds/ThreeDSim.3ds", 20f);
level=new Object3D(0);
for (int i=0; i<levelParts.length; i++) {
Object3D part=levelParts;
.
.
.
the "level" is correctly loaded and displayed in my IE window, while textures are correctly loaded too (I've check it in Sun Java Console) but they are not displayed; so objs that have materials without texture mapping are displayed correctly, but objs having materials with texture mapping are completly white.
Any suggestions to solve this problem? Thanks for any help :)
-
Maybe your naming when adding the textures to the manager doesn't match the naming of the textures in the material. The fps-example loads and adds them with their complete name, i.e. "car1.jpg", while in your applet example, you simply named the texture "car1".
Have a look at the console output...does the loader prints out some messages like
Texture named blahblah.jpg added to TextureManager!
? If so, your naming is definitely not correct and your should add your textures using the exakt name that's defined in the material.
-
Yes, you're right, now everything works fine.... Thank you very much :D