reading back compressed texture array.
Hello I am loading set of textures and create texture array from them in compressed format. This works fine because I see my shaders are working.
But later I decided to use compressed data from the beginning, so I want to read my texture array back and write it to hdd, so I can later load it as compressed data.
I was trying to use glGetCompressedTexImage, but there is no GL_TEXTURE_2D_ARRAY allowed as "target" for this function (I do not see it in documentation), so I am not sure if I can use it at all?
Or should I create separate 2d textures and save them instead?
Just to try out something I did like this:
glBindTexture(GL_TEXTURE_2D_ARRAY, tex );
GLint csize, is_comp;
GLint lod = 0;
glGetTexLevelParameteriv( ptex->m_Type, lod, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &csize);
glGetTexLevelParameteriv( ptex->m_Type, lod, GL_TEXTURE_COMPRESSED, &is_comp);
GLvoid* pdata = new unsigned char[csize];
glGetCompressedTexImage(GL_TEXTURE_2D_ARRAY, lod, pdata);
glBindTexture(GL_TEXTURE_2D_ARRAY, 0 );
But I have error "Invalid operation" after glGetCompressedTexImage.
Passing GL_TEXTURE_3D instead of GL_TEXTURE_2D_ARRAY to glGetCompressedTexImage also did not help :(
Any suggestions how that could be done?
UPDATE: problem solved, it was me, who forgot to glBindTexture(GL_TEXTURE_2D_ARRAY, tex ) in actual code, but put it in this test code :-)
However I still cannot understand how it works, because there is no GL_TEXTURE_2D_ARRAY present in documentation for "target" of glGetCompressedTexImage