When I run my program and hit Window.update(), I get the following error:
org.lwjgl.opengl.OpenGLException: Invalid value (1281)
at org.lwjgl.opengl.Util.checkGLError(Unknown Source)
at org.lwjgl.opengl.Window.update(Unknown Source)
at amazeingtank.MainMenuController.render(MainMenuController.java:102)
at amazeingtank.MainMenuController.run(MainMenuController.java:61)
at amazeingtank.gui.Game.run(Game.java:128)
at amazeingtank.gui.Game.main(Game.java:294)
I used org.lwjgl.opengl.Util.checkGLError() and isolated the following line:
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, 4, textureImage.getWidth(), textureImage.getHeight(), 0, GL11.GL_RGBA, GL11.GL_BYTE, scratch);
When I put the check error right after this line, I get the exception. I checked the BlueBook and all the parameters look acceptable. Can anyone see what is wrong with it?
I strongly suspect you wanted to be using GL11.GL_UNSIGNED_BYTE.
Also I recommend you use a symbolic constant like GL.GL_RGBA instead of '4' as your 3rd parameter - they "deprecated" using 1..4 for that parameter since GL1.1 (that's not your error though)
Cas :)
Sorry, copied it wrong. It was GL11.GL_UNSIGNED_BYTE. I was just trying different values to see if that would fix it. I also had GL11.GL_RGBA in that spot before. The reference book I was reading was online, so it was old. That is why I changed it to 4.
Thanks.
Figured it out. It was a power of 2 issue. My texture was not a power of 2.
Thanks.