Hi all,
sorry that I loose to set the reply into the group...so some answers has reached me and I got
some solution to solve...the primary failure was that I lost to set the index in the imageurls-array....
so blindness was the simple answer, but I got also nice hints about the general how do, so to
public the anwers here they are:


1.)
Alessandro Borges schrieb:
I should tell you can same time letting TextureLoader loads the image by itself, but I also have problems with TextureLoader in J3D 1.3.2 wich uses ImageIO.read(url) instead Toolkit.getImage(). My web hoster has some polycies about loading images from outside...


Check if you are really loading the images, printing the full path and image size after each loading.

Alessandro

2.)
Thierry Milard schrieb:
verification n°1) Check to see if img[i] is really an image by dispalaying img[i].getWidth() for exeample.
You wll be sure the url is correct.


verification n°2) If img[i] is a correct data image ... well I am not an expert. Here is a code that works on my computer.
Maybe you should do it like me with one more step with a Texture2D between the TextureLoader and the Texture itself.
Maybe beacause on the Texture2D you guve him the exact width and Height of the bloody image...
Who knows.
Good luck.
Appearance app = new Appearance();
app.setCapability(Appearance.ALLOW_TEXTURE_READ);
app.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
app.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ);
app.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE);
TextureLoader textLoad = new TextureLoader(anImage, *new Panel()*);


ImageComponent2D textImage = textLoad.getImage();
* Texture2D texture = new Texture2D(Texture2D.BASE_LEVEL, Texture.RGB, textImage.getWidth(), textImage.getHeight());
texture.setImage(0, textImage);
* TextureAttributes textAttr = new TextureAttributes();
textAttr.setTextureMode(TextureAttributes.REPLACE);


       app.setTexture(texture);
       app.setTextureAttributes(textAttr);

3.)
Gilson Laurent schrieb:

Hello

Well there are at least 4 points that just may go wrong....

On Wednesday 22 September 2004 18:26, you wrote:

loading the images:
Image[] img=new Image[imageurls.length];
URL url=null;
for(int i=0;i<pfad.length;i++){
try {
url=new URL(webpath+imageurls);



Are you 100% sure these URL's point to the right files ? Really ? You know these are case-sensitive ? Since you are using imageurls.length: didn't you want "imageurls[i]" ?



img[i] = getToolkit().getImage(url);



Here something is missing:
getToolkit().getImage(url) returns an empty image which will start loading when it's used. So the first time, you get a white image, next time you get a partialy loaded image....


add before the for-loop:
MediaTracker tracker = new MediaTracker(yourCanvas or "new JLabel()");

add after getToolkit().getImage(url):
tracker.addImage(img[i], 0);

add after the for-loop:
try {
  tracker.waitForAll();
}catch (Exception E){
}

The mediatracker loads the images completly. That may help.

Next point:

Texture tex = new TextureLoader(img[i],japplet).getTexture();



try:

BufferedImage BUF = new BufferedImage(your_width,your_height,BufferedImage.TYPE_INT_RGB);
Graphics g = BUF.getGraphics();
g.drawImage (img[i],0,0,new JLabel());
Texture tex = new TextureLoader(BUF).getTexture();


Make sure your_width and your_height are < 256. Some graphicscards can't handle bigger textures. For really old cards use < 128.


Next point:
The appearance and the ligh-soucres have to be "right". Have a look at the J3D-demos, and copy the code for the light and appearance from there.



Next point:
Having a texture is fine, but you need texture-coordinates as well. Try a Quad with the tex-coordinates: (0,0) (0,1) (1,1) (1,0). and the geo-coordinates: (0,0,0) (0,1,0) (1,1,0) (1,0,0)


QuadArray QA = QuadArray(4, TEXTURE_COORDINATE_2 | COORDINATES);

And fill in the data with setTextureCoordinate and setCoordinates.


good luck cu


best thanks to all of you ! rolf




Rolf Gabler-Mieck schrieb:

Hi,
I wanna create some woods and so far
I got n images and m coordinates
so the plan is  loading the images at first in an Image[]
and then set the image[i] to the TextureLoader,
but the result were just white "Images" - no trees...
so here's the code, if anybody got hints please let me know

loading the images:
     Image[] img=new Image[imageurls.length];
     URL url=null;
     for(int i=0;i<pfad.length;i++){
        try {
            url=new URL(webpath+imageurls);
        }
        catch (java.net.MalformedURLException ex) {
            System.out.println(ex.getMessage());
        System.exit(1);
        }
        img[i] = getToolkit().getImage(url);
     }

setting the Images:
...
Texture tex = new TextureLoader(img[i],japplet).getTexture();
...

but the result is that there're no Images, just white areas in the
recommended size

best regards
rolf

--
Rolf Gabler-Mieck
c/o
LGI-Geographisches Institut der CAU-Kiel
Ludewig-Meyen Str. 14
24098 Kiel
Tel: +49 431-880.2955
FAX: +49 431-880.4658
e-mail: [EMAIL PROTECTED]

===========================================================================

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".




--
Rolf Gabler-Mieck
c/o LGI-Geographisches Institut der CAU-Kiel
Ludewig-Meyen Str. 14
24098 Kiel
Tel: +49 431-880.2955
FAX: +49 431-880.4658
e-mail: [EMAIL PROTECTED]


===========================================================================
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