er…in my case…which part of my program need to modifiy???
JavaCoolDude’s Demo the WaterSimulation can not execute…
java.lang.Error: Cannot load image Data/Water.png
please help
fun fun fun ;D
/me stabs self in the face with a soldering iron :
hahahaa…i don’t know what happen actually…
i usually download the source code and put it on my desktop…and run the program…
or should i put the program to c: or else???
[quote]JavaCoolDude’s Demo the WaterSimulation can not execute…
java.lang.Error: Cannot load image Data/Water.png
please help
[/quote]
With Kevin’s 3ds loader I experienced the same problem - because I don’t put the app’s resource paths into the classpath.
Let’s asume your Java application stays in a folder with a subfolder “models/”, where the models as well as their textures are. In addition to the model’s InputStream we’ve to give the “models”/ path to the loader, too, in order it can find the textures. From the three (+) possibles ways to create a TDSLoader I can only use this one:
final String pathname = "models/";
final String modelfile = "Yourmodel.3ds";
InputStream bis = FileInputStream(pathname + modelfile);
TDSLoader dslader = new TDSLoader();
dslader.setGenerateMipMaps(true);
TDSModel model = dslader.load(pathname, bis, true);
This way it works fine, no matter how you start the Java application: via dosbox (java -cp …), or via double click on your App.jar, or at a friend’s PC (again with emtpy CLASSPATH).
import com.xith3d.scenegraph.VirtualUniverse;
import com.xith3d.scenegraph.View;
import com.xith3d.scenegraph.Locale;
import com.xith3d.scenegraph.BranchGroup;
import com.xith3d.scenegraph.Canvas3D;
import com.xith3d.scenegraph.DirectionalLight;
import com.xith3d.scenegraph.AmbientLight;
import com.xith3d.scenegraph.TransformGroup;
import com.xith3d.scenegraph.Transform3D;
import com.xith3d.render.RenderOptions;
import com.xith3d.render.Option;
import com.xith3d.render.CanvasPeer;
import com.xith3d.render.RenderPeer;
import com.xith3d.render.jogl.RenderPeerImpl;
import javax.vecmath.Vector3f;
import javax.vecmath.Color3f;
import java.util.ArrayList;
import org.newdawn.xith3d.threeds.TDSLoader;
import org.newdawn.xith3d.threeds.model.TDSModel;
import java.io.*;
public class TDSTest implements Runnable {
private View view;
private double lightAngle;
private double modelAngle;
private float anim = 0.0f;
private DirectionalLight light;
private TransformGroup tg = new TransformGroup();
private TDSModel model;
final String pathname = "model/";
final String modelfile = "character.3ds";
public TDSTest() {
VirtualUniverse universe = new VirtualUniverse();
view = new View();
view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
universe.addView(view);
Locale locale = new Locale();
universe.addLocale(locale);
view.setBackClipDistance(500.0f);
// setup view
view.getTransform().lookAt(
new Vector3f( 20, 10, 0), // location of eye (cubes)
new Vector3f( 0, 10, 0), // center of view (cubes)
new Vector3f( 0, 1, 0)); // vector pointing up
RenderPeer rp = new RenderPeerImpl();
CanvasPeer cp = rp.makeCanvas(null, 800, 600, 32, false);
Canvas3D canvas = new Canvas3D();
canvas.set3DPeer(cp);
view.addCanvas3D(canvas);
RenderOptions options = new RenderOptions();
options.setOption(Option.USE_SHADOWS,true);
options.setOption(Option.USE_LIGHTING,true);
cp.setRenderOptions(options);
BranchGroup root = new BranchGroup();
locale.addBranchGraph(root);
Color3f ambientColor = new Color3f(0.5f, 0.5f, 0.5f);
AmbientLight ambientLightNode = new AmbientLight(ambientColor);
root.addChild(ambientLightNode);
light = new DirectionalLight(true,new Color3f(1f,1f,1f),new Vector3f(0,0,1));
root.addChild(light);
TDSLoader.setDebug(true);
try {
long start = System.currentTimeMillis();
InputStream bis = new FileInputStream(pathname + modelfile);
TDSLoader dslader = new TDSLoader();
dslader.setGenerateMipMaps(true);
model = dslader.load(pathname, bis, true);
//model = new TDSLoader().load("character.3ds",true);
//model = new TDSLoader().load("model/cube_set/cube_rotation.3ds");
//model = new TDSLoader().load("model/jeep/jeep1.3ds",true);
//model = new TDSLoader().load("angel/angel.3ds",true);
//model = new TDSLoader().load("angel/chalice.3ds",true);
//model.setShowBounds(true,true);
//tg.addChild(model);
//model = new TDSLoader().load("model_set/redbox_max.3DS",true);
//model = new TDSLoader().load("jeep2/jeep.3ds",true);
//model = new TDSLoader().load("jeep2/scale.3ds",true);
//model = new TDSLoader().load("others/Tube.3ds",true);
//model = new TDSLoader().load("samples/Kugel.3ds",true);
//model = new TDSLoader().load("samples/building09.3ds",true);
//model = new TDSLoader().load("scaleanim/output.3ds",true);
System.out.println("Load took: "+((System.currentTimeMillis() - start) / 1000.0)+" seconds");
tg.addChild(model);
model.setShowBounds(true,true);
root.addChild(tg);
} catch (Exception e) {
e.printStackTrace();
}
new Thread(this).start();
}
public void run() {
int count = 0;
while (true) {
try { Thread.sleep(10); } catch (Exception e) {};
view.renderOnce();
lightAngle -= 0.01;
Vector3f dir = new Vector3f((float) -Math.cos(lightAngle),0,(float) Math.sin(lightAngle));
//light.setDirection(dir);
modelAngle += 0.01;
Transform3D yrot = new Transform3D();
yrot.rotY((float) modelAngle);
Transform3D xrot = new Transform3D();
//xrot.rotX((float) modelAngle);
//xrot.rotX((float) -Math.PI/2);
yrot.mul(xrot);
tg.setTransform(yrot);
anim += 0.005f;
if (anim > 1) {
anim = 0;
}
model.setTime(anim);
count++;
}
}
public static void main(String argv[]) {
new TDSTest();
}
}
this is the code i use to load the .3ds…it produce the same error to me
TDSLoader Debug Output
file: model/character.3ds
Init GL is net.java.games.jogl.impl.windows.WindowsGLImpl
OpenGL Renderer = GeForce2 MX/AGP/SSE/3DNOW!
OpenGL Version = 1.4.0
OpenGL Vendor = NVIDIA Corporation
OpenGL Extensions = GL_ARB_imaging GL_ARB_multitexture GL_ARB_point_parameters GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_transpose_matrix GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_window_pos GL_S3_s3tc GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_packed_pixels GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shared_texture_palette GL_EXT_stencil_wrap GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_object GL_EXT_vertex_array GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_fence GL_NV_fog_distance GL_NV_light_max_exponent GL_NV_packed_depth_stencil GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_register_combiners GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_NV_texture_rectangle GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NVX_ycrcb GL_SGIS_generate_mipmap GL_SGIS_multitexture GL_SGIS_texture_lod GL_WIN_swap_hint WGL_EXT_swap_control
java.io.IOException: Not found: model/character.3ds
at org.newdawn.xith3d.threeds.TDSLoader.load(TDSLoader.java:87)
at TDSTest.(TDSTest.java:80)
at TDSTest.main(TDSTest.java:137)
java.lang.NullPointerException
at TDSTest.run(TDSTest.java:130)
at java.lang.Thread.run(Thread.java:534)
any problem in my program??
Posting the whole program is excessive, especially not in a code block…
Based on previous posts, I’ll start with the obvious, do you have a file at the path “model/character.3ds” ?
yes i do have…is like this
c:\xith-3ds\model\character.3ds
i even put the character.3ds here
c:\xith-3ds\character.3ds
but still can not locate the file…and one more, even if i change the file name like this
final String pathname = "model/";
final String modelfile = "cube.3ds";
it still display the error message
*java.io.IOException: Not found: model/character.3ds
instead of
*java.io.IOException: Not found: model/cube.3ds
please tell me why it still look for character.3ds only but not for cube.3ds…i tried other files but still look for chracter.3ds
thanks
josh
Check the jar file for the loader and see if it has a class file in there with the same name as yours. I think you may not actually be executing your code, but code from the jar itself…
is it the xith-3ds.jar??? i do checked it, i execute but give me this
Failed to load Main-Class manifest attribute from
c:\xith\xith-3ds.jar
im using netbeans-ide as you know…
As stated before by others, you really need to brush up on Java basics.
Dont execute the Jar, open it up and look inside it. I think you’re gonna find a class file in there with the same name as yours. You’re going to want to remove it from the jar, or rename your class so it doesnt conflict.
Renaming your class may be easier for you.
im very sorry about this…im learning the basic java at the moment…other than Xith
any nice loader that can load animated .3ds recommend to me? thanks alot
This is just getting silly:
- Extract the contents of zip file. In there you will find:
- TDSTest.java - an example of how to use the loader
- org - the source for the loader, you won’t need this, and can just delete it.
- xith-3ds.jar - The jar file containing the binaries you need to use the loader.
-
Get a basic Xith demo running
-
Classpath through the xith-3ds.jar
-
Compile TDSTest.java
-
Run TDSTest
Kev
??? :-X
dude, you just went in a complete circle. You are wasting countless peoples time. Did you even read my last post?
I’m pretty sure my solution will fix your loading problem. But you’re gonna have lots of other issues because of your lack of fundamentals.
I wanted to program games in Java for a while, but it took quite a while to get the basics down, and I still have problems. Just takes time and experimentation.
im very sorry SpuTTer, i just asking only…i still want to learn Xith…please forgive me :-[ :’(
i did open the xith-3ds.jar inside got TDSTest.class, and i rename my class but still have the same error…
thanks
You renamed it, so I guess its not conflicting. What command line are you using to run the program?
you are compiling it after you make changes right?
Re: The loader--------
You already asked about a loader for animation. In fact, you made an entire posts about it:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1078859219
http://www.gamedev.net/community/forums/topic.asp?topic_id=212233
-
Make sure you can handle Xith3D - open this in Java Web Start http://xith.org/jws/jws-org.xith3d.gsg.HelloXith3D.jnlp (if you can’t - google for help).
-
Install Xith3D http://xith.org/installing.php
-
Bury youself in the tutorial - http://xith.org/tutes/GettingStarted/html/ Make sure you can compile Java programs. If not - google for help.
-
Think about using third party API’s such as the 3ds loader.
Will.
before compile i rename the TDSTest.java…im using NetBeans0IDE…so im not sure what command lines is using…since in NetBeans-IDE can easily compile program by just clicking the “execute icon” to F6.
??? :-X