Texturing problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Texturing problem

Boris
Hmm not even with texturing...
Im learning JOGL, and created simple application with a rotating textured square.
Here is code:
JoglApplication.java - http://pastebin.com/xfb3iVWz
JoglCanvas.java - http://pastebin.com/wQRRb1qu
When i run this via IDE (i use Eclipse), it works fine, textured square appears.
But if i try to export into executable jar, it dont works (IO exception - bad resource)
When i replace tex = createTexture("tex/tex1.jpg");
by tex = createTexture("/tex/tex1.jpg");
it works in executable jar, but dont works in IDE
And when i try to run .class via bat file, it dont work in both cases (the same IO exception)
can someone help me with this? how can i run it from bat file and IDE without exceptions?
Reply | Threaded
Open this post in threaded view
|

Re: Texturing problem

Demoscene Passivist
Administrator
Try using the InputStream method instead of the URL method ... like this:

Texture tTexture = TextureIO.newTexture(new BufferedInputStream((new Object()).getClass().getResourceAsStream(inFileName)),true,null);

... at least that works for me.