The app is failing to create the TextureLoader from the arguments you supply
so texLod0 is null hence the null pointer exception later on.
try something simple to see if the app can see the file:
java.io.File file = new java.io.File("sign1.gif");
System.out.println("the answer to whether I can see the file = " +
file.canRead());
Also,
the format argument you supply doesn't appear to be listed, try
new String("RGBA")
Also,
check that the class (this!) implements Obsever (and includes Update
method....)
and go from there..
If all else fails, buy some crayons.
David Turland
> This is the error message:
> Error: in loading image
> Error: in loading image
>
> allright till here
>
> java.lang.NullPointerException
> at
com.sun.j3d.utils.image.TextureLoader.getTexture(TextureLoader.java:342)
> at BoundingBox.createAppearances(BoundingBox.java:255)
> at BoundingBox.createSceneGraph(BoundingBox.java:81)
> at BoundingBox.init(BoundingBox.java:298)
> at sun.applet.AppletPanel.run(AppletPanel.java:357)
> at java.lang.Thread.run(Thread.java:479)
>
----- Original Message -----
From: ing. P.W.L. JANSSEN <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 22, 1999 9:46 AM
Subject: Re: [JAVA3D] texture mapping question
> Hi Renaud,
>
> Thanks for your advice, but unfortunaly it didn't work.
> This is my code :
> 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]);
>
> try{
> texLod0 = new TextureLoader(new
java.net.URL("file:sign1.gif"),new
> String("RGB"),this);
> texLod1 = new TextureLoader(new
java.net.URL("file:sign1.gif"),new
> String("RGB"),this);
> }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);
> }
>
> This is the error message:
> Error: in loading image
> Error: in loading image
>
> allright till here
>
> java.lang.NullPointerException
> at
com.sun.j3d.utils.image.TextureLoader.getTexture(TextureLoader.java:342)
> at BoundingBox.createAppearances(BoundingBox.java:255)
> at BoundingBox.createSceneGraph(BoundingBox.java:81)
> at BoundingBox.init(BoundingBox.java:298)
> at sun.applet.AppletPanel.run(AppletPanel.java:357)
> at java.lang.Thread.run(Thread.java:479)
>
> So I think it's the getTexture()- method that causes the problem. Do you
have a
> good example for me so I can compare the code?
>
> Many thanks in advance,
>
> Patrick
>
> CAZOULAT Renaud CNET/DIH/REN wrote:
>
> > Hi,
> >
> > a null pointer exception in texture loader often means it cannot find
the
> > texture.
> > Try to use the constructor with an url like :
> >
> > TextureLoader texLod0 = new TextureLoader(new java.net.URL
> > ("file:sign1.gif"),
> > new
String("RGB"),
> > this);
> >
> > It may work better (it did work for me).
> >
> > for the text below, don't bother because it concerns only *3D* texturing
> > (i.e. volumetric texturing) and I guess you want only to have a flat
(2D)
> > texture on your box ;-)
> >
> > > "Currently, Java 3D only takes advantage of 3D texture mapping on
> > > Solaris systems. On win32, the OpenGL version of the Java 3D dll is
> > > compiled with the Microsoft OpenGL header files, which do not define
> > > the 3D texture mapping extension. "
> > >
> > > My question is, does it still only works on solaris or is
> > > there allready
> > > a way to get it worked on a Win NT machine with Open GL?
> > >
> >
> > 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".
>
>
===========================================================================
> 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".
===========================================================================
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".