GL13.glCompressedTexImage2D issue

Started by abcdef, October 06, 2011, 23:09:07

Previous topic - Next topic

abcdef

Hi

When running the below line of code I get the following error

GL13.glCompressedTexImage2D(GL11.GL_TEXTURE_2D, 0, EXTTextureCompressionS3TC.GL_COMPRESSED_RGB_S3TC_DXT1_EXT, width, height, 0, data);



org.lwjgl.opengl.OpenGLException: Invalid value (1281)
	at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
	at org.lwjgl.opengl.GL13.glCompressedTexImage2D(GL13.java:163)


Does anyone know what the lwjgl error means? Which value does it think is invalid?

I wanted to add a size parameter but there wasn't one available with byte buffer as a parameter so I used the method shown

Fool Running

The size is implied from the remaining() method on the data buffer. Make sure you flip() the data buffer after you fill it with data and make sure your width and height are correct.

From the OpenGL spec:
QuoteGL_INVALID_VALUE is generated if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

abcdef

Thanks, I'd fixed it not soon after I posted but I didn't understand the error too much (I was loading mipmap data and had a bug, I normally rewind all my buffers as I ensure the size is correct to begin with rather than flip but thats a large reason for most buffer issues). I thought it might have been a lwjgl specific error so wanted to understand it for future reference.

Thanks for the help, wasn't a lwjgl error in the end but now I know to check the open gl error guides if I get a similar thing