1 Reply Latest reply on Mar 23, 2013 11:41 AM by sandro.digaia

    trouble with 2d array and compressed image

    sandro.digaia

      Hi all,

       

      I'm sandro, and I'm new of this blog. I'm implementing 2d array texturing with compressed images, but it seems doesn't work. I'm programming on 3870HD

      driver 13.1. Does this video card support 2d array texturing with compressed images? Here my code...

       

      // dummy texture creation

       

           Width = Descriptor->width;

           Height = Descriptor->height;

           Descriptor->source_format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;

           Descriptor->depth = 16;

       

           glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, i, Descriptor->source_format, Descriptor->width, Descriptor->height, Descriptor->array_size, 0,Width * Height * 4, NULL);

       

      // store all mipmap levels

           Offset = 0;

           for (UINT i = 0; i < Descriptor->num_mips && (Width || Height); ++i)

           {

                Size = ((Width + 3) / 4) * ((Height + 3) / 4) * Descriptor->depth;

                glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, i, Width, Height, 1, Descriptor->source_format, Size, Descriptor->data[0] + Offset);

       

                Offset += Size;

                Width /= 2;

                Height /= 2;

           }

       

      Is this code ok? If I'm using regular compressed imgae without array all is fine!

      Thanks in advance!