Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: reading back compressed texture array.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Nov 2012

    Question 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:

    Code :
            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
    Last edited by alariq; 10-16-2013 at 08:13 AM. Reason: problem solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts