加载图片的代码
Texture tex = null;
File img = new File("src/images/earth.jpg");
try {
tex = new TextureLoader(ImageIO.read(img)).getTexture();
} catch (IOException e) {
e.printStackTrace();
}
tex.setBoundaryModeS(Texture.WRAP);
tex.setBoundaryModeT(Texture.WRAP);
TextureAttributes texAttr = new TextureAttributes();
texAttr.setTextureMode(TextureAttributes.MODULATE);
Appearance ap = new Appearance();
ap.setTexture(tex);
ap.setTextureAttributes(texAttr);
------
Node earth = new Sphere(earthRadius, primflags, 100, ap);
我错过了一些明显的东西吗? 任何帮助或指针都会狂热分子。如果我没有提供足够的细节,请询问,我将非常乐意提供更多代码。