TextureIO.newTexture with remote (http) files

Hi all,

I am trying to create a new tecture from a remove file on the net with the following code snippet,


		        try {
		        	System.out.println("Getting the URL\n");
		        	URL url = new URL("http://people.na.infn.it/~carrillo/rpc/frog/crop/637566997.png");        
		        	System.out.println("Getting the Texture\n");		        	
		            texture = TextureIO.newTexture(url, false, "png");
		        }
		        catch (IOException exc) {
		            exc.printStackTrace();
		            System.exit(1);
		        }			

but its basically stuck for ever at the newTexture line…

Same code with local file works like a charm…
And the URL is fine and I am getting the image instataniously in my web browser, so…
What did I miss?

Thanks,
Loic

Hi

Which version of JOGL do you use? It is strange as I used com.jogamp.opengl.util.texture.TextureIO several times in such a case and it was working.

I am using jogl-2.0
But it is good to hear that it is suppose to work :wink:

Please can you try to load the image without JOGL just to check if the problem really comes from it? Use Class.getResourceAsStream(), check its return value isn’t null.

when I do:
InputStream stream = jfrog.Common.class.getResourceAsStream(“http://people.na.infn.it/~carrillo/rpc/frog/crop/637566997.png”);
I get a stram that is equal to null… but I can’t understand why, since the url is ok in my browser…
Can it be because of the tilde ("~") ?

I also tried this:
InputStream stream = new URL(“http://people.na.infn.it/~carrillo/rpc/frog/crop/637566997.png”).openStream();
but it get stuck for ever again…

any advice?
Loic

Nevermind…
I made it working:

	        try {
	        	URL url = new URL("http://people.na.infn.it/~carrillo/rpc/frog/crop/637566997.png");
	        	if(url!=null)texture = TextureIO.newTexture(url, false, "png");		        	
	        }
	        catch (IOException exc) {
	        	System.out.printf("Texture not found");
	        }