I have a DXT1 texture loaded in a ByteBuffer and I'm trying to load it with Opengl
int tID = glGenTextures();
glBindTexture(GL_TEXTURE_2D, tID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, w, h, 0, imageData);
System.out.println(gluErrorString(glGetError()));
It's giving me the error "Invalid Operation" on the glCompressedTexImage2D call. Can't seem to figure out why.
Thanks
Never mind, i solved my problem.
The size of the imageData was wrong.
Because DXT1 is 4 bits per pixel, i kept thinking the size should be w * h * 4.
However, since 4 bits is half a byte, it should have been w * h / 2.
Wasted an entire day because of that error.
I really wish opengl had better error reporting, instead of just "Invalid Operation".
But i guess that would compromise performance, i don't know.