Thanks Ive just tried this.

It unfortulately does not work.
I thought I was loading in the image with the lines

ImageComponent2D image = loader.getImage();
Texture2D texture = new
Texture2D(Texture.BASE_LEVEL,Texture.RGBA,image.getWidth(),
image.getHeight());

and finally.
texture.setImage(0, image);

Actually I must be doing this because this code works elsewhere for loading
textures onto the walls (shape3Ds) of a Box Object.

Im curious that it should work for the Box object shape3Ds and not the
imported shape3Ds. Im able to change the materials but not apply textures.

Is there any trick with TextureAttributes that has to be set (and is being
set by the Box Class and therefore it works for the box and not otherwise)

Thankyou for your help

Adrian
----- Original Message -----
From: "Kevin Duling" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 1:15 AM
Subject: Re: [JAVA3D] Texture problem for newbe


> You're not loading the variable 'texture' up with the texture you loaded
in
> from TextureLoader.
>
> Replace this line:
>         Texture2D texture = new Texture2D(Texture.BASE_LEVEL,
> Texture.RGBA,image.getWidth(), image.getHeight());
>
> with this one:
>         Texture texture = loader.getTexture();
>
>
> ----- Original Message -----
> From: Adrian Meekings <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 06, 2001 11:31 PM
> Subject: [JAVA3D] Texture problem for newbe
>
>
> > Hi folks.
> >
> > The following code will not place a texture (that I can see anyway onto
an
> object)
> >
> > Appearance appearance = (Appearance)shape3D.getAppearance();
> > TextureLoader loader = new TextureLoader(directoryString,applet);
> file://applet is the applet used for this program
> >
> > ImageComponent2D image = loader.getImage();
> >
> >       if(image == null) {
> >             System.out.println("load failed for texture:
> "+directoryString);
> >        // never gets into here ... good
> >       }
> >
> >
> >       file://Texture texture = appearance.getTexture();  // try this out
> gives null therefore there is no texture object yet
> >       Texture2D texture = new Texture2D(Texture.BASE_LEVEL,
> Texture.RGBA,image.getWidth(), image.getHeight());
> >       texture.setBoundaryModeS(Texture.WRAP);  file://THIS IS THE
DEFAULT
> ANYWAY
> >       texture.setBoundaryModeT(Texture.WRAP);  file://THIS IS THE
DEFAULT
> ANYWAY
> >
> >       texture.setImage(0, image);
> >       appearance.setTexture(texture);
> >       appearance.setTextureAttributes(new TextureAttributes());  // do I
> have to do this?? it doesnt seem to make a difference
> > //      shape3D.setAppearance(appearance); file://does not have to be
done
> >
> > This code works fine on the individual shape3D objects of a Box object
(I
> use a Box object for the walls of a room).
> > But wont work on any imported objects. (ie the tables and chairs)
> >
> > Is there anything else I have to set within the shape3D inorder to allow
> me to render this texture?
> >
> > I can change the material properties of the shape3D easily enough (there
> is already a material object present in the appearance object)
> >
> >
> >
> > Thanks for getting this far down the page
> > Cheers
> > Adrian
> >
> >
>
===========================================================================
> > 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".

Reply via email to