Got it! I added the res folder as A class folder, so when I did /res/texBrick.png it didn't work because it's referneced as /texrBrick.png, Ah Me...
JAVA - JWJGL - IO Error: Input == Null
-
04-08-2022 - |
Question
I Keep Getting this when trying to load a texture from "/res/texBrick.png":
Exception in thread "Thread-0" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
at com.palo.verde.tut.lwjgl.basic.Main.loadTexture(Main.java:127)
at com.palo.verde.tut.lwjgl.basic.Main.initVar(Main.java:120)
at com.palo.verde.tut.lwjgl.basic.Main.run(Main.java:37)
at java.lang.Thread.run(Unknown Source)
Here is texture load code:
private int loadTexture(String string) {
int tex;
BufferedImage img = null;
try {
img = ImageIO.read(Main.class.getResourceAsStream(string));
} catch (IOException e) {
e.printStackTrace();
return 0;
}
int imgWidth = img.getWidth();
int imgHeight = img.getHeight();
// ...
}
This is really weird, considering in the video I was following it worked! Any Help would be appreciated.
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow