Can't read compressed texture back from Gl

I keep getting the error "Attempted to read or write protected memory." with the call to Gl.glGetCompressedTexImageARB. The compressed texture displays correctly but I am unable to get it back from Gl so I can save it to disk. Here is the partial code.

Gl.glBindTexture(Gl.GL_TEXTURE_2D, mytexture);

Gl.glGetTexLevelParameteriv(Gl.GL_TEXTURE_2D, mmnum,
Gl.GL_TEXTURE_COMPRESSED_ARB, out compressed);

if (compressed == Gl.GL_TRUE)
{

Gl.glGetTexLevelParameteriv(Gl.GL_TEXTURE_2D, mmnum,
Gl.GL_TEXTURE_INTERNAL_FORMAT,
out internal_format);

Gl.glGetTexLevelParameteriv(Gl.GL_TEXTURE_2D, mmnum,
Gl.GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB,
out compressed_size);

byte[] img = new byte[compressed_size];

***** This is the line that gets the error ******
Gl.glGetCompressedTexImageARB(Gl.GL_TEXTURE_2D, mmnum, img);

}

Fixed it. I downloaded the

Fixed it.

I downloaded the release build of the latest Tao.OpenGl.dll and it is working correctly.

Theme by La Boite a site | Powered by Drupal