CAZOULAT Renaud CNET/DIH/REN wrote:
> > The app is failing to create the TextureLoader from the
> > arguments you supply
> > so texLod0 is null hence the null pointer exception later on.
I've tried it with an other image and with a canvas3d as the observer but still
the same message.As you can see in the message texLod0 isn't null and because of
the try-catch block by creating the textureloaders I suspect that the loaders
are created well.
Again code and error-message
c3d= javax.media.j3d.Canvas3D[canvas0,0,0,0x0,invalid]
before texture loader
Error: in loading image
Error: in loading image
texLod0= com.sun.j3d.utils.image.TextureLoader@e5aac6ba
texLod1= com.sun.j3d.utils.image.TextureLoader@fd72c6ba
allright till here
java.lang.NullPointerException
at com.sun.j3d.utils.image.TextureLoader.getTexture(TextureLoader.java:342)
at BoundingBox.createAppearances(BoundingBox.java:262)
at BoundingBox.createSceneGraph(BoundingBox.java:82)
at BoundingBox.init(BoundingBox.java:305)
at sun.applet.AppletPanel.run(AppletPanel.java:357)
at java.lang.Thread.run(Thread.java:479)
public void createAppearances()
{
Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
Color3f deepRed = new Color3f(0.9f, 0.2f, 0.1f);
Color3f royalBlue = new Color3f(0.1f, 0.3f, 0.9f);
Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
mat = new Material[2];
app = new Appearance[2];
ta = new TextureAttributes[2];
mat[0] = new Material(royalBlue,royalBlue,royalBlue,white, 1.0f);
mat[1] = new Material(deepRed,deepRed,deepRed,white, 1.0f);
for (int i = 0; i < 2; i++) {
app[i] = new Appearance();
ta[i] = new TextureAttributes();
}
app[0].setMaterial(mat[0]);
app[1].setMaterial(mat[1]);
app[0].setTextureAttributes(ta[0]);
app[1].setTextureAttributes(ta[1]);
c3d=new Canvas3D(null);
System.err.println("c3d= "+c3d);
try{
System.err.println("before texture loader");
texLod0 = new TextureLoader(new java.net.URL("file:earth.jpg"),new
String("RGBA"),c3d);
texLod1 = new TextureLoader(new java.net.URL("file:sign1.gif"),new
String("RGB"),c3d);
System.err.println("texLod0= "+texLod0);
System.err.println("texLod1= "+texLod1);
}catch (java.net.MalformedURLException mfe){
System.err.println("wrong url, can't find file sign1.gif");
}
System.err.println("allright till here");
Texture tex0 = texLod0.getTexture(); System.err.println("tex0=
"+tex0);
Texture tex1 = texLod1.getTexture(); System.err.println("tex1=
"+tex1);
if (tex0!=null) app[0].setTexture(tex0);
if (tex1!=null) app[1].setTexture(tex1);
}
> Exactly, as the internal BufferedImage has not been loaded (i.e. is still
> null), a null pointer exception is raised when trying to resize the image to
> a power of 2 (bufferedImage.getWidth())
> This should be check in a next version of java3D ?
>
> renaud
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
--
----------------------------------------------------
ing. Patrick Janssen
[EMAIL PROTECTED]
3i communication
intelligent interactive internet communication
http://www.3icommunication.com/
tel: 040-2960040, fax: 040-2960041
----------------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".