I am developing an application which uses “Ericsson Texture Compression format” for texturing in OpenGL ES 1.1.
Unfortunately I always end up with “GL_INVALID_VALUE” error while I call “glCompressedTexImage2D”. I also tried varying the parameters but I was not successful.
The sample texture in ETC format was created using PVRTtools and also I am using licensed libraries.
Either use “+13” instead of “+52” or “((GLubyte*)etc_texture) + 13”. Because etc_texture is an GLuint-array “etc_texture + 52” will return a pointer 208 (52*sizeof(etc_texture[0])) bytes past etc_texture. Pointer arithmetic in C/C++ operates in units of the datatype-size.
I suppose you are checking that the device you are targeting actually supports OES_compressed_ETC1_RGB8_texture?
Apart from that, the size parameter you use is incorrect. The dwDataSize field in the header is the size of the entire mipmap chain, but what you need to pass to glCompressedTexImage2D is the size of a single mipmap level. The PVRTools library in the PowerVR SDK contains functions which will load textures in PVR format correctly.
However, in case you want to do it in your own code: