Texture problem

Started by CaptainJester, May 24, 2004, 03:14:42

Previous topic - Next topic

CaptainJester

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?
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

princec

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 :)

CaptainJester

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.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

CaptainJester

Figured it out.  It was a power of 2 issue.  My texture was not a power of 2.

Thanks.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)