LWJGL Forum

Programming => OpenGL => Topic started by: abcdef on October 06, 2011, 23:09:07

Title: GL13.glCompressedTexImage2D issue
Post by: abcdef on October 06, 2011, 23:09:07
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
Title: Re: GL13.glCompressedTexImage2D issue
Post by: Fool Running on October 07, 2011, 12:35:37
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.
Title: Re: GL13.glCompressedTexImage2D issue
Post by: abcdef on October 07, 2011, 14:02:00
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