bonjour à tous,

voilà je cherche à faire un logo en jpg, donc je veux installer java3d

je l'ai telecharger v.1.5.1 que j'ai installer dans (sous vista) :

C:\Program Files\Java\Java3D\1.5.1 ou ce trouve dejà

C:\Program Files\Java\jdk1.5.0_07

C:\Program Files\Java\jre1.6.0_03

je travaille sous eclipse, donc je créer un projet suite au tutaux trouvé sur le net pour me familiariser un peu.

je prends donc un exemple que je met sur eclispe :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
 
import com.sun.j3d.utils.geometry.*;
 
import com.sun.j3d.utils.universe.*;
 
import com.sun.j3d.utils.image.*;
 
import javax.media.j3d.*;
 
import javax.vecmath.*;
 
import java.awt.Container;
 
public class PictureBall {
 
public PictureBall() {
 
// Créer l’univers
 
SimpleUniverse universe = new SimpleUniverse();
 
// Créer une structure contenant les objets
 
BranchGroup group = new BranchGroup();
 
// Configurer les couleurs
 
Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
 
Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
 
Color3f red = new Color3f(0.7f, .15f, .15f);
 
// Configurer la texture
 
TextureLoader loader = new TextureLoader("K:\\3d\\Arizona.jpg", "LUMINANCE", new Container());
 
Texture texture = loader.getTexture();
 
texture.setBoundaryModeS(Texture.WRAP);
 
texture.setBoundaryModeT(Texture.WRAP);
 
texture.setBoundaryColor( new Color4f( 0.0f, 1.0f, 0.0f, 0.0f ) );
 
 
// Configurer les attributs de la texture
 
// Paramètres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
 
TextureAttributes texAttr = new TextureAttributes();
 
texAttr.setTextureMode(TextureAttributes.MODULATE);
 
Appearance ap = new Appearance();
 
ap.setTexture(texture);
 
ap.setTextureAttributes(texAttr);
 
 
//Configurer le matériau
 
ap.setMaterial(new Material(red, black, red, black, 1.0f));
 
 
// Créer une sphère pour y appliquer les textures
 
int primflags = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS; 
 
Sphere sphere = new Sphere(0.5f, primflags, ap);
 
group.addChild(sphere);
 
// Créer les éclairages
 
Color3f light1Color = new Color3f(1f, 1f, 1f);
 
BoundingSphere bounds =new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
 
Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
 
DirectionalLight light1= new DirectionalLight(light1Color, light1Direction);
 
light1.setInfluencingBounds(bounds);
 
group.addChild(light1);
 
AmbientLight ambientLight = new AmbientLight(new Color3f(.5f,.5f,.5f));
 
ambientLight.setInfluencingBounds(bounds);
 
group.addChild(ambientLight); 
 
// Regarder vers l&a sphère pour lui faire face
 
universe.getViewingPlatform().setNominalViewingTransform();
 
// Ajouter les groupe d’objets à l’univers
 
universe.addBranchGraph(group);
 
}
 
public static void main(String[] args) {
 
new PictureBall();
 
}
 
}
et là j'ai un bug un message d'eclipse :

Exception in thread "main" com.sun.j3d.utils.image.ImageException: javax.imageio.IIOException: Can't read input file!
at com.sun.j3d.utils.image.TextureLoader$1.run(TextureLoader.java:344)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.j3d.utils.image.TextureLoader.<init>(TextureLoader.java:337)
at com.sun.j3d.utils.image.TextureLoader.<init>(TextureLoader.java:304)
at PictureBall.<init>(PictureBall.java:36)
at PictureBall.main(PictureBall.java:107)
Caused by: javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(Unknown Source)
at com.sun.j3d.utils.image.TextureLoader$1.run(TextureLoader.java:342)
... 5 more


j'ai bien recuperé l'image et mise dans le projet.

se pourrait t-il que je n'ai pas toute les biblotheques de java3D ? et que je dois installer une mise à jour de java3D avec d'autres bibliotheques ? pouvez vous m'aidez ?