From: kaffiene <kaf...@xt...> - 2003-04-28 01:18:46
|
Byron Wright wrote: >put the png in a jar file then do something like > >URL url = YourClass.class.getResource("your.png"); > >Image img=Toolkit.getDefaultToolkit().getImage(url); > > >So if your class is called "Game" > >URL url = Game.class.getResources("your.png"); > >rememeber that the string you pass to the getResources method is the >path in the jar file to the image so > >getResources("/your.png") would point to the root of the jar file. > >There is another method that might be helpful: > >InputStream in = Game.class.getResourceAsStream("your.png"); > >Then you can do whatever you want with the inputstream. > >-Byron > > I'm sorry, what I meant to ask was how to load a png and use it as a texture in gl4java. The gl4java png texture loader doesn't support inputstreams. Just file names or URLs.. Apologies for the poorly worded request ;-) Peter. |