public void GetData <T>( CubeMapFace cubeMapFace, int level, Rectangle?rect, T[] data, int startIndex, int elementCount ) where T : struct { if (data == null || data.Length == 0) { throw new ArgumentException("data cannot be null"); } if (data.Length < startIndex + elementCount) { throw new ArgumentException( "The data passed has a length of " + data.Length.ToString() + " but " + elementCount.ToString() + " pixels have been requested." ); } int subX, subY, subW, subH; if (rect == null) { subX = 0; subY = 0; subW = Size >> level; subH = Size >> level; } else { subX = rect.Value.X; subY = rect.Value.Y; subW = rect.Value.Width; subH = rect.Value.Height; } int elementSizeInBytes = Marshal.SizeOf(typeof(T)); ValidateGetDataFormat(Format, elementSizeInBytes); GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); FNA3D.FNA3D_GetTextureDataCube( GraphicsDevice.GLDevice, texture, subX, subY, subW, subH, cubeMapFace, level, handle.AddrOfPinnedObject() + (startIndex * elementSizeInBytes), elementCount * elementSizeInBytes ); handle.Free(); }