title: PVRTC texture with mipmaps stays black
body: <p>I recently updated my loading code for textures and also added some new features like mipmap loading ( the last application has been only 2D so i didn't need them ). But the loaded PVRTC textures stay black when using mipmaps, without mipmaps everything works like expected and also mipmaps are working when using textures like RGBA8888 textures.</p>
  <p><strong>Loading of the compressed data:</strong></p>
  <pre><code>for (int i = 0; i &lt; source.MipmapCount; i++)
  {
      data = source.GetData(i);
      GLTextures.CompressedTexImage2D(TextureType.TEXTURE_2D, i, Format.CompressedFormat.Value, Width &gt;&gt; i, Height &gt;&gt; i, data.Length, data);
      Debug.WriteGLError(&quot;Texture2D-&gt;CompressedTexImage2D&quot;, &quot;MipmapLevel={0}&quot;, i);
  }
  </code></pre>
  <p><strong>Setup of the filtering:</strong></p>
  <pre><code>if (source.MipmapCount == 0)
  {
      switch (filterQuality)
      {
          case FilterQuality.Nearest:
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MIN_FILTER, (Int32)TextureMinFilterParams.NEAREST);
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MAG_FILTER, (Int32)TextureMagFilterParams.NEAREST);
              break;
          case FilterQuality.Linear:
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MIN_FILTER, (Int32)TextureMinFilterParams.LINEAR);
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MAG_FILTER, (Int32)TextureMagFilterParams.LINEAR);
              break;
      }
      Debug.WriteGLError(&quot;Texture2D-&gt;TexParameteri without mipmaps&quot;);
  }
  else
  {
      switch (filterQuality)
      {
          case FilterQuality.Nearest:
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MIN_FILTER, (Int32)TextureMinFilterParams.NEAREST_MIPMAP_LINEAR);
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MAG_FILTER, (Int32)TextureMagFilterParams.NEAREST);
              break;
          case FilterQuality.Linear:
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MIN_FILTER, (Int32)TextureMinFilterParams.LINEAR_MIPMAP_LINEAR);
              GLTextures.TexParameteri(TextureType.TEXTURE_2D, TexParameter.TEXTURE_MAG_FILTER, (Int32)TextureMagFilterParams.LINEAR);
              break;
      }
  
      Debug.WriteGLError(&quot;Texture2D-&gt;TexParameteri with mipmaps&quot;);
  
      if (anisotropicQuality &gt; 1f &amp;&amp; GL.IsExtensionSupported(Extension.GL_EXT_texture_filter_anisotropic))
      {
          // GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 
          GLTextures.TexParameter(TextureType.TEXTURE_2D, 0x84FF, Mathf.Clamp(anisotropicQuality, 1f, GL.GetFloat(GetFloatName.TEXTURE_MAX_ANISOTROPY)));
          Debug.WriteGLError(&quot;Texture2D-&gt;Anisotropy&quot;);
      }
  }
  </code></pre>
  <p><strong>Loading of the texture</strong>
  The loading is done with a modified reference-loader for PVR files. I checked the length of the bytes of each mipmap and the last few arrays have the size of 32 bytes ( minimum size of PVRTC ). What could cause the issue?</p>
  <h3>Edit</h3>
  <p>The method &quot;GLTextures.CompressedTexImage2D&quot;.</p>
  <pre><code>public static void CompressedTexImage2D(TextureType target, Int32 level, CompressedFormats internalFormat, Int32 width, Int32 height, Int32 imageSize, Byte[] pixels)
  {
      /* Used for mobile apps for debugging purposes */
      Debug.CheckMethodLoaded(glCompressedTexImage2D);
      Profiler.IncreaseCallCount(&quot;glCompressedTexImage2D&quot;);
      glCompressedTexImage2D(target, level, internalFormat, width, height, 0, imageSize, pixels);
  }
  </code></pre>
  <p><strong>Image formats definition:</strong></p>
  <pre><code>PVRTC2RGB = new ImageFormat(&quot;PVRTC2RGB&quot;, CompressedFormats.COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 16, 8, bitsPerPixel: 2, requiredExtension:Extension.GL_IMG_texture_compression_pvrtc);
  PVRTC2RGBA = new ImageFormat(&quot;PVRTC2RGBA&quot;, CompressedFormats.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 16, 8, bitsPerPixel: 2, requiredExtension: Extension.GL_IMG_texture_compression_pvrtc);
  PVRTC4RGB = new ImageFormat(&quot;PVRTC4RGB&quot;, CompressedFormats.COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 8, 8, bitsPerPixel: 4, requiredExtension: Extension.GL_IMG_texture_compression_pvrtc);
  PVRTC4RGBA = new ImageFormat(&quot;PVRTC4RGBA&quot;, CompressedFormats.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 8, 8, bitsPerPixel: 4, requiredExtension: Extension.GL_IMG_texture_compression_pvrtc);
  </code></pre>