Hello Guest

GL13.glCompressedTexImage2D issue

  • 2 Replies
  • 7543 Views
*

Offline abcdef

  • ****
  • 336
GL13.glCompressedTexImage2D issue
« on: October 06, 2011, 23:09:07 »
Hi

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

Code: [Select]
GL13.glCompressedTexImage2D(GL11.GL_TEXTURE_2D, 0, EXTTextureCompressionS3TC.GL_COMPRESSED_RGB_S3TC_DXT1_EXT, width, height, 0, data);


Code: [Select]
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
« Last Edit: October 06, 2011, 23:12:04 by abcdef »

Re: GL13.glCompressedTexImage2D issue
« Reply #1 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:
Quote
GL_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

*

Offline abcdef

  • ****
  • 336
Re: GL13.glCompressedTexImage2D issue
« Reply #2 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